Problem running jar files of java in Linux

I cannot run jar files in java/jdk1.3.1_01/demo in Readhat Linux 6.2
The command is :--
[root@localhost Notepad]# java -jar Notepad.jar
java.lang.NoClassDefFoundError: javax/swing/JPanel
at java.lang.Class.forName(Class.java:33)
at kaffe.jar.ExecJarName.main(ExecJarName.java:58)
at kaffe.jar.ExecJar.main(ExecJar.java:61)
[root@localhost Notepad]#
My ~/profile setting is :---
PATH="$PATH:/usr/X11R6/bin:/usr/java/jdk1.3.1_01/bin:/usr/java/jdk1.3.1_01/jre/bin:/usr/java/jre/lib"
export JAVA_HOME=/usr/java/jdk1.3.1_01
export NPX_PLUGIN_PATH=/usr/java/jdk1.3.1_01/jre/plugin/i386/ns4

[root@localhost Notepad]# java -jar Notepad.jar
java.lang.NoClassDefFoundError: javax/swing/JPanel
at java.lang.Class.forName(Class.java:33)
at
at
at kaffe.jar.ExecJarName.main(ExecJarName.java:58)
at kaffe.jar.ExecJar.main(ExecJar.java:61)
[root@localhost Notepad]#
My ~/profile setting is :---
PATH="$PATH:/usr/X11R6/bin:/usr/java/jdk1.3.1_01/bin:/u
r/java/jdk1.3.1_01/jre/bin:/usr/java/jre/lib"
export JAVA_HOME=/usr/java/jdk1.3.1_01
export
NPX_PLUGIN_PATH=/usr/java/jdk1.3.1_01/jre/plugin/i386/n
4Add the line:
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar
Then, run the command "source ~/.profile" and then the jar file should be able to run.
Bhav

Similar Messages

  • Running .jar files from Java code

    Hi.
    I am designing a sort of platform to run some games which are saved in .jar files. Basically this platform is a menu from which the user can select the game which he/she wants to run. It also has the feature of adding new games.
    Is is possible to run the .jar file from within java code?
    Thanks for any help!
    Krt_malta

    Just list the jar in the classpath list and call the class in the jar.

  • How to run .jar on linux & how to create .jar file using java?

    hi, may i know how to run .jar on linux & how to create .jar file using java? Can u provide the steps on doing it.
    thanks in advance.

    Look at the manual page for jar:
    # man jar
    Also you can run them by doing:
    # java -jar Prog.jar

  • Running .jar files in linux on double click

    Hi,
    i needed a solution to run the jar files on double click in linux system.Necessity is mainly because when i run the jar file by java -jar myapp.jar in terminal it works fine .Iam running my app continuosly in system tray(a server kind).But if i close the terminal my app exits.
    How to resolve this ?

    I am taking a SWAG.....it sounds like your problem is how to run a java app without a terminal window. So as I recall, there is some way in Linux to enter a command and have it execute in a new process. I don't recall the syntax but maybe putting a '&' character in the command line? Anyway, you should be able to use the method and use "javaw" instead of "java" to launch your app. You should be able to do this in a batch file too. Something like, javaw -jar yourjar.jar &

  • Can't run .jar file with JavaSE

    Hello.
    I'm trying to run a .jar file with JavaSE Binary, just like I did with Windows. I Ctrl+Rclick and pick "Open with..." and there is no such option. I've been searching the whole day for a solution, I kept getting "Open Java Preferences... put on top of the list" and things like that. There is no "Java Preferences" in the Utilities folder, and nothing related to my problem in "Java Control Panel" in System Preferences. Yes, I have Java 7. I just need to run this file with Java. How?
    Thanks in advance.

    Max. allowed size of .jar file is 1MB.

  • How to run ear file in java application server

    i want how to run .ear file in java application server
    1. i m created ear file
    2. i m created jar file (bean,home,remote)
    3.i m created war file(in the form of jsp)
    but till now i couldnt run ear file
    how to run
    please hel me

    You must create :
    1.Jar file
    2.War file
    And then put them into an ear file
    Exemple : myapp.ear contains
    myappEJB.jar
    myappWEB.war
    META-INF/application.xml
    and application.xml looks like this :
    <application xmlns="http://java.sun.com/xml/ns/j2ee" version="1.4"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com /xml/ns/j2ee
                            http://java.sun.com/xml/ns/j2ee/application_1_4.xsd">
        <display-name>myapp</display-name>
        <description>Demo application</description>
        <module>
            <ejb>myappEJB.jar</ejb>
        </module>
        <module>
          <web>
             <web-uri>myappWAR.war</web-uri>
             <context-root>/myapp</context-root>
          </web>
        </module>
    </application>Good luck

  • Strange......problem with batch file in java

    hi,
    my problem is that i have created one bat file and i want to run that file in java but it is not running properly. the problem is .......
    i have created one bat file named "file1.bat" & content of this file is as follows :-
    [ ag > b.txt]
    (and content of file "ag" is "aaaaaaa" )
    now i am trying to run this bat file in java and want to read this b.txt in which i have redirected the content of file "ag".
    for that i have written the code like this:-file name is "runbf.java"
    import java.awt.*;
    import java.lang.Runtime;
    import java.io.*;
    public class DriveVol
    public static void main(String args[]) throws IOException
    int volumn;
    Runtime r = Runtime.getRuntime();
    r.exec("ss.bat");
    FileInputStream fp;
    fp = new FileInputStream("b.txt");
    flush();
    do
    volumn = fp.read();
    System.out.print((char)volumn);
    }while(volumn != -1);
    fp.close();
    when i am running this programme first it is not displaying the content of b.txt. but when u run this prog twice then only it 'll give the correct ans. what i mean is, i'll explain that stepwise.
    1. as per my prog. -- r.exec("aa.bat") -- this line 'll execute first. so content of ag 'll redirect to file "b.txt"
    2. now i am trying to read the file "b.txt" using FIleInputStream...
    3. but first time it is giving some garbbage value.when i give --c:jdk1.3\bin>java runbf
    4. but the very next moment when again i run that file - c:jdk1.3\bin>java runbf
    it 'll give the correct value.
    5. again when i change the content of file ag(suppose "bbbbbbb"). & try to run "runbf.java" like this-
    -- c:jdk1.3\bin>java runbf --
    6. then it 'll display the value "aaaaaa". now when again i run that file
    it 'll give the correct value "bbbbbb"
    7. so every time i have to run that "runbf.java" twice for printing the correct
    value of file "b.txt"
    so what i think is that, it is not refreshing the data of file "b.txt". after executing this line
    r.exec("aa.bat");
    so is there any method to refresh the data of file "b.txt"??????
    i think u 'll try to understand my problem...
    so please help me to get the ans.......
    thx.........

    pls can anyone hlp............

  • Console not display when run jar file

    i run jar file with command javaw -jar test.jar or double click on jar file, it's console app, it just run well but console not display, can i made console display and when i close console, it's stop jar file too?
    thanks

    i got it, javaw = no console window, i tried java command and i got error: can not access jar file?

  • Running exe files from java applications

    Hello All,
    Is it possible to run executable files from java applications?
    I need to run an exe file on the client from the server machine, the exe could reside on either the server or any other machine on the LAN. Is it possible to specify the path of where the exe resides, and run it on a client machine?

    HI,
    I tried to launch a MS Word application using runtime.exec but it gives me some problem
    The foll. code to launch a txt file using notepad works.
    Runtime rt = Runtime.getRuntime();
    String[] callAndArgs = {"notepad.exe","C:\\coo7\\wizard.txt"};
    Process child = rt.exec(callAndArgs);
    However, oif I try to launch a MS Word application, it asks for the entire path of WINWORD.exe, (unlike just specifying notepad.exe as the first argument in String[] callAndArgs) and this can vary from one machine to another.. how do I get around this?
    The foll. code snippet works but the complete path of where WINWORD.exe might be installed on any machine, is not fixed:-(
    Runtime rt = Runtime.getRuntime();
    String[] callAndArgs = {"C:\\Program Files\\Office\\Office10\\WINWORD.exe","C:\\coo7\\wizard.doc"};
    Process child = rt.exec(callAndArgs);
    Any idea/suggestions pls..

  • Running batch files thraugh java by passing parameters

    Hi
    I want to run a batch file by passing some parameters.
    Eg: copy.bat "D:\live\hoe.txt" "D:\test"
    while doing this from command prompt its working and i have written some java code for running this batch file.
    String live="D:\\live\\how.txt";
    String test="D:\\test";
    String bat="D:\\copy.bat";
    String[] command = new String[3];
    command[0] = bat;
    command[1] = live;
    command[2] = test;
    try {
    Runtime.getRuntime().exec(command);
    } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    but this time its not copying the file;
    Please help.

    Just another cross poster.
    [http://www.java-forums.org/new-java/15005-running-batch-files-thraugh-java-passing-parameters.html]
    db

  • Running  .nsi file from java

    hi,
    Ho to run .nsi file from java.
    thanks in advance.

    User845466 wrote:
    Ho to run .nsi file from java.Find the program hanling that kind of documents an launch this via Runtime.exec() giving it your *.nsi file as a parameter.
    bye
    TPD

  • Append to jar file using java codings

    Hi,
    I have codings which could create jar file and write datas in it. but i need to append datas to existing jar file using java codings.Here i have attached my codings which will write datas to new jar file. when ever i use this my existing contents gets overritten. wat can i add to this to append.
    FileOutputStream stream = new FileOutputStream(archiveFile,true);// archive file is jar file name
         JarOutputStream out = new JarOutputStream(stream, new Manifest());
    JarEntry jarAdd = new JarEntry(tobeJar.getName()); // tobejar is a file to write in jar.
    jarAdd.setTime(tobeJar.lastModified());
                   out.putNextEntry(jarAdd);
                   // Write file to archive
                   FileInputStream in = new FileInputStream(tobeJar);
                   while (true) {
                   int nRead = in.read(buffer, 0, buffer.length);
                   if (nRead <= 0)
                   break;
                   out.write(buffer, 0, nRead);
                   out.closeEntry();
    out.close();

    JarInputStream in = new JarInputStream(new FileInputStream(oldJarName), true); // oldJarName is the JAR that contains all the files we want to keep
    JarOutputStream out = new JarOutputStream(new FileOutputStream(tempJarName)); // this is your "out" variable
    // copy the files from the old JAR to the new, but don't close the new JAR yet
    JarEntry inEnt;
    while ((inEnt = in.getNextJarEntry()) != null) {
      JarEntry outEnt = new JarEntry(inEnt); // copy size, modification time etc.
      byte[] data = inEnt.getSize();
      in.read(data); // read data for this old entry
      in.closeEntry();
      out.putNextEntry(outEnt);
      out.write(data); // copy it to the new entry
      out.closeEntry();
    // now write an entry for the file we want to append - this is the OP's code
    JarEntry jarAdd = new JarEntry(tobeJar.getName()); // tobejar is a file to write in jar.
    jarAdd.setTime(tobeJar.lastModified());
    out.putNextEntry(jarAdd);
    // Write file to archive
    FileInputStream in = new FileInputStream(tobeJar);
    while (true) {
    int nRead = in.read(buffer, 0, buffer.length);
    if (nRead <= 0)
    break;
    out.write(buffer, 0, nRead);
    out.closeEntry();
    // and *now* we close the new JAR file.
    out.close();
    // We then delete the old JAR file...
    new File(oldJarName).delete();
    // ... and rename the new JAR file to use the old one's name.
    new File(tempJarName).renameTo(new File(oldJarName));

  • Writing into a jar file through Java program

    Is there a way to get a file from a jar (for ex. a properties file) make changes to it on the fly and write the same file back to the jar through a Java program?

    I cannnot give u exact code as i am bit busy..but i am giving close to exact
    below is code for reading contents of jar file
    import java.io.*;
    import java.util.jar.*;
    public class JarRead {
    public static void main (String args[])
    throws IOException {
    if (args.length != 2) {
    System.out.println(
    "Please provide a JAR filename and file to read");
    System.exit(-1);
    JarFile jarFile = new JarFile(args[0]);
    JarEntry entry = jarFile.getJarEntry(args[1]);
    InputStream input = jarFile.getInputStream(entry);
    process(input);
    jarFile.close();
    private static void process(InputStream input)
    throws IOException {
    InputStreamReader isr =
    new InputStreamReader(input);
    BufferedReader reader = new BufferedReader(isr);
    String line;
    while ((line = reader.readLine()) != null) {
    System.out.println(line);
    reader.close();
    now here say u have test.jar which contains test.txt (file)
    then
    java JarRead test.jar test.txt
    will print content of text.txt
    now in ur case u write content of each file in some other file modify it there and then create a jar file from those files using jaroutput stream .....
    this may not be all clear ..but what to do..bit busy...u are welcomed to make changes in above stratergy....n queries if any after using above stratergy and/or your great brain...

  • JAR file for java.sql.Timestamp?

    What is the JAR file for java.sql.Timestamp?
    It would be nice to have a directory file or .sh script to find these.
    -- Ewin

    rt.jar has it. Pretty much anything java.* is in rt.jar
    Rob

  • .jar file for java mock exams

    Dear all,
    please tell me where can i find the .jar file of java mock exams?
    Thanking you,
    Mitesh.

    I don't know about a .jar file, but here is a link for some
    quizzes: http://developer.java.sun.com/developer/Quizzes/
    Mark

Maybe you are looking for

  • SOS!! SOS!! HELP ME!!! The mobo won't load/boot windows from the SCSI Drive!!! HELP!!!

    Ok so i got the board and the crucial RAM with a new enermax 450W power supply. I am running the 1MB A64 3400+ CG on this board. I am using the Seagate cheetah 15.3K SCSI drive with a LSI 21320 SCSI controller (http://www.lsilogic.com/products/ultra3

  • How to add a printer

    Hi, How could i add my HP LaserJet 4015n network printer in Solaris 10 & then register through EBS 12.1.1. Please guide.

  • SAP XI in SOA

    HI, We have SAP R/3 4.7, SAP SRM4.0, SAP CRM4.0 and SAP BW-SEM4.0 in system landscape. The implementation is following SOA (Service Oriented Architecture). 1. There is CRM middleware is available to integrate CRM with SAP R/3. 2. SAP BW connector to

  • Netflix stopped working today 5/27/14

    Netflix stopped working on my dinosaur iPad this evening. Tried all Netflix fixes, spoke to tech support, no help. App loads to browse screen, then crashes back to iPad home screen. Was working earlier in the day, and roku was fine up until I switche

  • Itunes is using up all my RAM.

    I have ripped my collection of dvds onto my computer. I also have videos from my video camera that I have put onto my computer. When i try to edit there info in itunes it takes a very long time. I have also noticed that I will open up itunes with 2 G