I will simply provide my .bat file in hopes that someone can guide me in the right direction. I have been given several tips and hints, but no one has been able to walk me through this and considering I have never even touched Java before I have no idea what I'm doing. I primarily use c++ and vb. Here is the .bat file I am trying to compile.

"C:\JAVA\bin\javac.exe" "C:\Users\smartparts\Documents\POWERTRAK\Java Source Code\Server_Client14\Constants.java"

"C:\JAVA\bin\javac.exe" "C:\Users\smartparts\Documents\POWERTRAK\Java Source Code\Server_Client14\NetComm.java"

"C:\JAVA\bin\javac.exe" "C:\Users\smartparts\Documents\POWERTRAK\Java Source Code\Server_Client14\srvr_ClientGui.java"

"C:\JAVA\bin\javac.exe" "C:\Users\smartparts\Documents\POWERTRAK\Java Source Code\Server_Client14\srvr_GThread.java"

"C:\JAVA\bin\javac.exe" "C:\Users\smartparts\Documents\POWERTRAK\Java Source Code\Server_Client14\srvr_GsmMain.java"

"C:\JAVA\bin\jar.exe" cf "C:\Users\smartparts\Documents\POWERTRAK\Java Source Code\Server_Client14\srvr_Client.jar" "C:\Users\smartparts\Documents\POWERTRAK\Java Source Code\Server_Client14\Constants.class" NetComm.class srvr_ClientGui$1.class srvr_ClientGui$2.class srvr_ClientGui$3.class srvr_ClientGui$4.class srvr_ClientGui$5.class srvr_ClientGui$RadioListener.class srvr_ClientGui.class srvr_GThread.class srvr_GsmMain$1.class srvr_GsmMain.class srvr_GThread.class

"C:\JAVA\bin\jar.exe" umf "C:\Users\smartparts\Documents\POWERTRAK\Java Source Code\Server_Client14\srvr_ClientJarText" "C:\Users\smartparts\Documents\POWERTRAK\Java Source Code\Server_Client14\srvr_Client.jar"

Recommended Answers

All 11 Replies

Have those been compiled yet? If it is looking for the physical class files, those are not created until after the java program has been compiled.

Have those been compiled yet? If it is looking for the physical class files, those are not created until after the java program has been compiled.

No they haven't... I didn't write these files just so you know I got them from our parent company, but they are garbage... I think after looking at the files that I am trying to compile the actual files are bad. I keep bringing up tons of errors. Java is a pain... lol

It is definatley not for the faint of heart.
I have only been using it for about a month now, and if it were not for the guys out here I think I would have eaten a bullet by now!

You don't mention what problem you are having with the batch file - but I am thinking it's probably a class path issue. Are you getting things like "No class def found" ?

javac needs to know the class path to find any other classes that your java file is using. This can be specified with the -cp option for the javac command or it can be set via the CLASSPATH environment variable. Here is some more info on that:
http://java.sun.com/javase/6/docs/technotes/tools/windows/classpath.html

If you got that batch file from another source, you might see if there is another file like "setEnv.bat" in the directory, which sets the environment classpath. If so, run that one first.

If you got that batch file from another source, you might see if there is another file like "setEnv.bat" in the directory, which sets the environment classpath. If so, run that one first.

I appreciate the help, but that is not what it is. I'm getting errors from the commands in the files im calling in the batch file. I have basically concluded that the place I got these from is worthless...

I appreciate the help, but that is not what it is. I'm getting errors from the commands in the files im calling in the batch file. I have basically concluded that the place I got these from is worthless...

Again, you don't state what the specific errors are. If you posted some of them it might help.

Or u can do one thing

go to start->run->cmd
u will come to dos prompt
type cd\[enter]
then type set P[Enter]
After this u will c the path i suppose ur javec path is not set
so u set by using following command
if u installed in c:\ with name jdk1.4
then
set PATH=c:\jdk1.4\bin;c:\jdk1.4\lib;c:\jdk1.4\jre\bin;jdk1.4\jre\lib%PATH%[Enter]
after that whenever u want to compile the programs u have to go initially c:\jdk1.4\bin
then save that file in that folder and 
run javac filename.java
java filename

Hope that would help.....

This is basically what im getting when I try to run the batch file in cprompt.


C:\Users\smartparts\Documents\POWERTRAK\Java Source Code\Server_Client14>"C:\JAV
A\bin\jar.exe" cf "C:\Users\smartparts\Documents\POWERTRAK\Java Source Code\Serv
er_Client14\srvr_Client.jar" "C:\Users\smartparts\Documents\POWERTRAK\Java Sourc
e Code\Server_Client14\Constants.class" "C:\Users\smartparts\Documents\POWERTRAK
\Java Source Code\Server_Client14\NetComm.class" "C:\Users\smartparts\Documents\
POWERTRAK\Java Source Code\Server_Client14\srvr_ClientGui$1.class" "C:\Users\sma
rtparts\Documents\POWERTRAK\Java Source Code\Server_Client14\srvr_ClientGui$2.cl
ass" "C:\Users\smartparts\Documents\POWERTRAK\Java Source Code\Server_Client14\s
rvr_ClientGui$3.class" "C:\Users\smartparts\Documents\POWERTRAK\Java Source Code
\Server_Client14\srvr_ClientGui$4.class" "C:\Users\smartparts\Documents\POWERTRA
K\Java Source Code\Server_Client14\srvr_ClientGui$5.class" "C:\Users\smartparts\
Documents\POWERTRAK\Java Source Code\Server_Client14\srvr_ClientGui$RadioListene
r.class" "C:\Users\smartparts\Documents\POWERTRAK\Java Source Code\Server_Client
14\srvr_ClientGui.class" "C:\Users\smartparts\Documents\POWERTRAK\Java Source Co
de\Server_Client14\srvr_GThread.class" "C:\Users\smartparts\Documents\POWERTRAK\
Java Source Code\Server_Client14\srvr_GsmMain$1.class" "C:\Users\smartparts\Docu
ments\POWERTRAK\Java Source Code\Server_Client14\srvr_GsmMain.class" "C:\Users\s
martparts\Documents\POWERTRAK\Java Source Code\Server_Client14\srvr_GThread.clas
s"
C:\Users\smartparts\Documents\POWERTRAK\Java Source Code\Server_Client14\NetComm
.class : no such file or directory
C:\Users\smartparts\Documents\POWERTRAK\Java Source Code\Server_Client14\srvr_Cl
ientGui$1.class : no such file or directory
C:\Users\smartparts\Documents\POWERTRAK\Java Source Code\Server_Client14\srvr_Cl
ientGui$2.class : no such file or directory
C:\Users\smartparts\Documents\POWERTRAK\Java Source Code\Server_Client14\srvr_Cl
ientGui$3.class : no such file or directory
C:\Users\smartparts\Documents\POWERTRAK\Java Source Code\Server_Client14\srvr_Cl
ientGui$4.class : no such file or directory
C:\Users\smartparts\Documents\POWERTRAK\Java Source Code\Server_Client14\srvr_Cl
ientGui$5.class : no such file or directory
C:\Users\smartparts\Documents\POWERTRAK\Java Source Code\Server_Client14\srvr_Cl
ientGui$RadioListener.class : no such file or directory
C:\Users\smartparts\Documents\POWERTRAK\Java Source Code\Server_Client14\srvr_Cl
ientGui.class : no such file or directory
C:\Users\smartparts\Documents\POWERTRAK\Java Source Code\Server_Client14\srvr_GT
hread.class : no such file or directory
C:\Users\smartparts\Documents\POWERTRAK\Java Source Code\Server_Client14\srvr_Gs
mMain$1.class : no such file or directory
C:\Users\smartparts\Documents\POWERTRAK\Java Source Code\Server_Client14\srvr_Gs
mMain.class : no such file or directory
C:\Users\smartparts\Documents\POWERTRAK\Java Source Code\Server_Client14\srvr_GT
hread.class : no such file or directory

C:\Users\smartparts\Documents\POWERTRAK\Java Source Code\Server_Client14>"C:\JAV
A\bin\jar.exe" umf "C:\Users\smartparts\Documents\POWERTRAK\Java Source Code\Ser
ver_Client14\srvr_Client.jar" "C:\Users\smartparts\Documents\POWERTRAK\Java Sour
ce Code\Server_Client14\srvr_ClientJarText"
java.io.IOException: invalid header field
at java.util.jar.Attributes.read(Attributes.java:393)
at java.util.jar.Manifest.read(Manifest.java:182)
at java.util.jar.Manifest.<init>(Manifest.java:52)
at sun.tools.jar.Main.update(Main.java:530)
at sun.tools.jar.Main.run(Main.java:184)
at sun.tools.jar.Main.main(Main.java:1022)
C:\Users\smartparts\Documents\POWERTRAK\Java Source Code\Server_Client14>


basically it is not making any class files.

Well, I assume that is only part of the batch file, or you are supposed to run another batch before that one, because it is trying to create a jar file from classes that aren't there. Do you have any docs for this POWERTRAK stuff or is it an internal app?

OK thanks for all the help guys, but i figured it out... all in all I'm retarted. lol I had the class files being saved to the c:\java dir but trying to be called from my users dir. again thanks for the help and sorry I'm such a nublet...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.