aspose file tools*
The moose likes Java in General and the fly likes help regarding batch file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "help regarding batch file" Watch "help regarding batch file" New topic
Author

help regarding batch file

pvsr rao
Ranch Hand

Joined: Oct 05, 2005
Posts: 102
from the java program i have written two batch files.when i execute the program first batch file is executing ,but secong batch file is giving error.when i cameout of the java program and start execute that batch file,it is working.please tell me how to solve this problem
Chetan Parekh
Ranch Hand

Joined: Sep 16, 2004
Posts: 3636
What error it is throwing?

Post you Java code and batch files.


My blood is tested +ve for Java.
Chetan Parekh
Ranch Hand

Joined: Sep 16, 2004
Posts: 3636
For debugging append the content of second batch file to the first batch file and execute only the first batch file. See what happens.
[ October 27, 2005: Message edited by: Chetan Parekh ]
pvsr rao
Ranch Hand

Joined: Oct 05, 2005
Posts: 102
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;

public class swing extends JFrame implements ActionListener
{
JLabel ldomain = new JLabel("ldomain");
JLabel lserver = new JLabel("lserver");
JLabel lusername = new JLabel("lusername");
JLabel lpassword = new JLabel("lpassword");
JLabel lrootdirectory= new JLabel("lrootdirectory");
JLabel lconfigfile = new JLabel("lconfigfile");
JLabel lport= new JLabel("lport");


JTextField tdomain = new JTextField(20);
JTextField tserver = new JTextField(20);
JTextField tusername= new JTextField(20);
JPasswordField tpassword=new JPasswordField(20);

JTextField tconfigfile=new JTextField(20);
JTextField trootdirectory=new JTextField(20);
JTextField tport=new JTextField(20);


JButton create = new JButton("create");

public swing(){
create.addActionListener(this);

getContentPane().setLayout( new FlowLayout());

getContentPane().add(ldomain);
getContentPane().add(tdomain);

getContentPane().add(lserver);
getContentPane().add(tserver);

getContentPane().add(lusername);
getContentPane().add(tusername);

getContentPane().add(lpassword);
getContentPane().add(tpassword);



getContentPane().add(lrootdirectory);
getContentPane().add(trootdirectory);

getContentPane().add(lport);
getContentPane().add(tport);

getContentPane().add(lconfigfile);
getContentPane().add(tconfigfile);


getContentPane().add(create);

setSize(600,400);
setVisible(true);


this.addWindowListener
(
new WindowAdapter()
{

public void windowClosing( WindowEvent e){
System.exit(0);
}
}
);
}


public static void main(String args[]) {
new swing();
}

public void actionPerformed(ActionEvent ae)

{
try
{
if(ae.getSource()==create)
{
String s1 = tdomain.getText();
String s2 = tserver.getText();
String s3 = tusername.getText();
String s4 = tpassword.getText();
String s6= trootdirectory.getText();
String s7= tport.getText();
String s8= tconfigfile.getText();


String s = "", str = " ";
s = s1.concat(" ").concat(s2).concat(" ").concat(s3).concat(" ").
concat(s4);
System.out.println(s);
String str1 = "java -Dweblogic.Domain=" + s1;
System.out.println(str1);
String str2 = " -Dweblogic.Name=" + s2;
System.out.println(str2);
String str3 = " -Dweblogic.management.username=" + s3;
System.out.println(str3);
String str4 = " -Dweblogic.management.password=" + s4;
System.out.println(str4);
String str6=" -Dweblogic.RootDirectory="+s6;
System.out.print(str6);
String str7="-Dweblogic.ListenPort="+s7;
System.out.println(str7);

String str8=" -Dweblogic.ConfigFile="+s8;
str = str1.concat(" ").concat(str2).concat(" ").concat(str3).
concat(" ").concat(str4).concat(" ").concat(str6).concat(" ").concat(str7).concat(" ").concat(str8).concat(" ")+ "weblogic.Server";
System.out.println(str);

Runtime r=Runtime.getRuntime();
String s11=" d:/bea/weblogic700/server/bin/setWLSEnv.cmd";

System.out.println("Before executing batch file");
boolean success =new File("d:/bea/weblogic700/server/bin/subrahmanyam").mkdir();




FileWriter f1= new FileWriter("d:/puvvada/swings/test/swings/bb.bat");

f1.write(s11);


Process p1=r.exec("cmd /c start d:/puvvada/swings/test/swings/bb.bat");
f1.close();


FileWriter f2= new FileWriter("d:/puvvada/swings/test/swings/cc.bat");

f2.write(str);


Process p2=r.exec("cmd /c start d:/puvvada/swings/test/swings/cc.bat");
f2.close();






System.out.println("after executing batch fiole");

}
} catch(Exception e)
{
System.out.println(e);
}


}
}


from the java program i have to start weblogicserver by interactively giving the domainname,servername,username,password,configfilename,portnumber etc.
i have written two batch files.first batch file is working.in the second batch file the exception
Exception in thread "main" java.lang.NoClassDefFoundError: weblogic/Server

please tellme how to solve this problem.iam trying for 3 days,but notable to catch the problem
Chetan Parekh
Ranch Hand

Joined: Sep 16, 2004
Posts: 3636
Originally posted by pvsr rao:

Exception in thread "main" java.lang.NoClassDefFoundError: weblogic/Server


You are getting error because your 2nd bat file is not able to find a particular jar file in class path.

Post the complete error message.
pvsr rao
Ranch Hand

Joined: Oct 05, 2005
Posts: 102
i got that error message only.i have used (e.printStackTrace())also
i have set the classpath d:/bea/weblogic700/server/lib/weblogic.jar;
Chetan Parekh
Ranch Hand

Joined: Sep 16, 2004
Posts: 3636
Use System.getProperty(“java.class.path”) and check whether the particular jar file is really there or not.
[ October 27, 2005: Message edited by: Chetan Parekh ]
Chetan Parekh
Ranch Hand

Joined: Sep 16, 2004
Posts: 3636
Hey just comment following lines and execute programm

FileWriter f1= new FileWriter("d:/puvvada/swings/test/swings/bb.bat");
f1.write(s11);
Process p1=r.exec("cmd /c start d:/puvvada/swings/test/swings/bb.bat");
f1.close();
pvsr rao
Ranch Hand

Joined: Oct 05, 2005
Posts: 102
ya,that particular weblogic.jar is not there.but from the command prompt ihave given that jar file.how to set that jar file.
i have given as
from the woking directory
d:/bea/weblogic70/server/lib/weblogic.jar;
Chetan Parekh
Ranch Hand

Joined: Sep 16, 2004
Posts: 3636
Originally posted by pvsr rao:
ya,that particular weblogic.jar is not there.but from the command prompt ihave given that jar file


This won’t work.

Set in environment variable setting option.

The “quick and dirty” way : just copy that jar file in JAVA_HOME\jre\lib\ext folder.
pvsr rao
Ranch Hand

Joined: Oct 05, 2005
Posts: 102
Thankyou chetan. the server is running.but the following exception is comming
java.lang.UnsatisfiedLinkError: no wlntio in java.library.path
ava.lang.UnsatisfiedLinkError: no wlntio in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1491)
at java.lang.Runtime.loadLibrary0(Runtime.java:788)
at java.lang.System.loadLibrary(System.java:834)
at weblogic.socket.NTSocketMuxer.<init>(NTSocketMuxer.java:195)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruc
rAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Delegating
nstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at java.lang.Class.newInstance0(Class.java:308)
at java.lang.Class.newInstance(Class.java:261)
at weblogic.socket.SocketMuxer.makeTheMuxer(SocketMuxer.java:54)
at weblogic.socket.SocketMuxer.getMuxer(SocketMuxer.java:37)
at weblogic.t3.srvr.ListenThread.run(ListenThread.java:210)
pvsr rao
Ranch Hand

Joined: Oct 05, 2005
Posts: 102
Thankyou for your support chetan,its working fine
JuanP barbancho
Ranch Hand

Joined: Oct 25, 2005
Posts: 52
Hi,

you need this libwlntio.sl in the libpath, classpath ...

Or you need aply a fix patch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: help regarding batch file