Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Not able to run jar file

Reply
Thread Tools

Not able to run jar file

 
 
Sheshagiri Sheshagiri is offline
Junior Member
Join Date: Dec 2012
Posts: 1
 
      12-16-2012
Hi am new to Java..I am testing java code in below steps..

1. ..Logger\Message.java files has below code..

package logger;
public class Message
{
public String GetFormattedMessage(String s)
{
return "Hello " + s;
}
}

2. Another file ..Logger\LogMessage.java with below

package logger;
public class LogMessage
{
public static void main(String[] args)
{
Message m = new Message();

String messageText = "";
for(String s: args)
{
messageText += s;
}
System.out.println(m.GetFormattedMessage(messageTe xt));
}
}

3. Created directory "Classes" under Logger folder and compiled java files as below
>javac -d "classes" Message.java
>javac -d "classes" -classpath "classes" LogMessage.java
4. Created manifest file (I may be failing here)
\Logger\Manifest.txt

"Main-Class: logger.LogMessage A B

"
4. Creating jar file as below (May failed here too..
>jar cvfm logger.jar manifest.txt *.* (Dont know how to include only "Classes" folder in jar)
5. When i ran >java -jar logger.jar i will get error as below
"Error: Could not find or load main class logger.LogMessage A B"

Without Jar file below code works fine ..
>java -classpath "classes" logger.LogMessage A B
output : Hello AB

Please help in solving this problem or suggest corrected approach..
Thanks in advance,
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Not able to display color in excel not able to display color in excel using xml sed_y XML 0 02-15-2012 09:46 PM
java -cp a.jar -jar b.jar => Works on Windows, not on Debian cyberco Java 4 02-14-2006 06:27 AM
jaas.jar, jta.jar jdbc-stdext.jar missing from jdk1.5 RPM muttley Java 0 10-20-2005 02:40 PM
Differences of xercesImpl.jar, xercesImpl-J.jar, dom3-xercesImpl.jar ? Arnold Peters Java 0 01-05-2005 10:59 PM
Differences of xercesImpl.jar, xercesImpl-J.jar, dom3-xercesImpl.jar ? Arnold Peters XML 0 01-05-2005 10:59 PM



Advertisments