Skip to main content

Posts

How to write command in process Builder

I am Running shell script using cygwin and java. ProcessBuilder pb =new ProcessBuilder ("sh", "app.sh", "ib2", "12", "11", "AK-RD", "02.20", "D:\\cygwin\\bin\\test\\delta"); My script is running when i am hard coding parameters. I want to pass these parameters through text box values. How to do this. String cmmd[] = new String[8]; cmmd[0] ="\"sh\""; cmmd[1] ="\"app.sh\""; cmmd[2] ="\""+txt_threeltr.getText()+"\""; cmmd[3] ="\""+txt_month_c.getText()+"\""; cmmd[4] ="\""+txt_year_C.getText()+"\""; cmmd[5] ="\""+txt_partNumber.getText()+"\""; cmmd[6] ="\""+txt_version.getText()+"\""; cmmd[7] ="\""+txt_destinationname.getText()+"\"

browser keeps on looking for the data but never fetches it

Following is a snippet that is meant to fetch the data from the database. But when i click the submit button to see the data, the browser keeps on looking for the data but never displays anything (the browser doesn't show the next page but keeps on looking on the same page) . I don't know what the problem is. Snippet that fetches the data : public void doGet(HttpServletRequest request,HttpServletResponse response) throws IOException,ServletException { try { Context context = new InitialContext(); DataSource dataSource = (DataSource)context.lookup("java:comp/env/jdbc/MyDatasource"); Connection connection = dataSource.getConnection(); String sqlStatement = "SELECT * FROM INFORMATION"; PreparedStatement statement = connection.prepareStatement(sqlStatement); ResultSet set = statement.executeQuery(); PrintWriter writer = response.getWriter(); response.setContentType("text/plain");

Clarify what is asked for in java Exceptions assignment

It does not appear evident to me what is asked in a java assignment I have received. Does anyone understand what is needed: In the previous assignment, you implemented a stack and a list that both inherited from the abstract class ArrayIntCollection. In this task you are supposed to extend that implementation by make it throw exceptions if you try to perform operations that are not allowed (for example, if you try to call pop or peek on an empty stack or if you try to remove an element from a non existing position). You shall create and use the exception class CollectionException, of the type UncheckedException. Also write a test program ExceptionMain.java that generates and catches exceptions from your modified methods. The way I understand it, I need to create a exception class called CollectionException , and it needs to extend UncheckedException . (this itself is not working, as I cannot find a class called UncheckedException ). Also, it is obvious if I am to use t

What maven dependency need to have Class LocalContainerEntityManagerFactoryBean?

In my project class LocalContainerEntityManagerFactoryBean not found. I don't understand why? In other simple project with this class all works fine. <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> <property name="persistenceUnitName" value="simpleTest" /> <property name="dataSource" ref="dataSource" /> <property name="jpaVendorAdapter"> <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"> <property name="showSql" value="true" /> <property name="generateDdl" value="true" /> <property name="databasePlatform" value="org.hibernate.dialect.H2Dialect" /> </bean> </property> </bean>

ArrayList objects

Need some inputs: Lets say i have N ArrayList and in each i am adding foo() object. Foo foo = new Foo() A.add(foo); B.add(foo); N.add(foo); Now modification done on any one foo() object will reflect in all the other arraylist? If YES WHY? and whether this behaviour can also be achieved using any other collection like Vector etc...? IF i make foo as null will it reflect in all arraylist?

Convert android.graphics.path value into String?

I have an ArrayList of Path values. I need to convert it into String values and know what all coordinates were covered in the Path. Here's the code that I worked up: private ArrayList<Path> pointsToDraw = new ArrayList<Path>(); private List<String> stringPoints ; synchronized(pointsToDraw){ for(Path path : pointsToDraw) { stringPoints.add(String.valueOf(path)); } TextView b1Text = (TextView) findViewById(R.id.GText); for(String s : stringPoints) { b1Text.setText(s); } } I get an exception during runtime. The following is the log content : 02-21 18:18:29.323: E/AndroidRuntime(512): FATAL EXCEPTION: main 02-21 18:18:29.323: E/AndroidRuntime(512): java.lang.NullPointerException 02-21 18:18:29.323: E/AndroidRuntime(512): at learn.myandroidapp.hr.HRCanvas$1.on