How can I run a java program on Linux?

I have JBuilder's IDE installed on my Linux partition and it works. However I don't know how to compile and test a program without it. Also I tried to install Limewire on Linux and although I've installed the Java SDK on the system. Once before I installed JBuilder and then JBuilder (I guess) installed it again. However it told me it couldn't find the Java Virtual Machine. Isn't this installed with the JDK? I am able to run programs through JBuilder so I can't see why I'd have a problem. Any answers to the above issues would be greatly appreciated.

Go here and work out how to make a simple app to compile and run on the command line: http://java.sun.com/docs/books/tutorial/getStarted/cupojava/unix.html#2b
(You should find the JDK from a directory under the jbuilder directory so use that and not the /usr/local/jdk1.4 in the example.)
Then find the classes or source code of your project and do the same thing to it.

Similar Messages

  • How can i run my java program with out java language

    Hai to every one ..Iam new to java language ...am using windows xp operating system , i did not installed java language in my system .. how can i run a java program with out installing java language... Which files is requied to run java program..?
    any one can help me??

    Hai to every one ..Iam new to java language ...am
    using windows xp operating system , i did not
    installed java language in my system .. how can i run
    a java program with out installing java language...
    you ... can ... not ... do ... this
    Which files is requied to run java program..?
    any one can help me??a JVM. Download it from sun's website.
    [url http://java.sun.com/javase/downloads/index.jsp]Download JavaSE here

  • How can i run my java program in background process?

    hi all,
    i am working on desktop monitoring so when i start my program on client machine that is visible to all but i want this program client not visible to all instead of this can be run in background process . so, nobody can see that.
    so, how i can do this ?
    pls pls help me
    thanks in advanced to helper
    regards
    maulik & ritesh

    this will run the java program in the background.It'll just use the Windows Java Console instead of the command-line console. It has nothing to do with running as a background process.
    Edit: though this might be exactly what the OP wants: not "background process" but "no DOS console".

  • How can I run this java program? Please help.

    I have jmf installed, sunone running , the file may be in the wrong directory.
    It is in some directory nowhere near the java lang dir.
    When I try to compile or build i cant. I'm off on a basic thing.
    here is the code.
    import     javax.sound.midi.InvalidMidiDataException;
    import     javax.sound.midi.MidiDevice;
    import     javax.sound.midi.MidiSystem;
    import     javax.sound.midi.MidiUnavailableException;
    import     javax.sound.midi.Receiver;
    import     javax.sound.midi.MidiMessage;
    import     javax.sound.midi.ShortMessage;
    import     javax.sound.midi.SysexMessage;
    public class MidiNote
         /**     Flag for debugging messages.
              If true, some messages are dumped to the console
              during operation.
         private static boolean          DEBUG = false;
         public static void main(String[] args)
              try {
                   // TODO: make settable via command line
                   int     nChannel = 0;
                   int     nKey = 0;     // MIDI key number
                   int     nVelocity = 0;
                   *     Time between note on and note off event in
                   *     milliseconds. Note that on most systems, the
                   *     best resolution you can expect are 10 ms.
                   int     nDuration = 0;
                   int     nArgumentIndexOffset = 0;
                   String     strDeviceName = null;
                   if (args.length == 4)
                        strDeviceName = args[0];
                        nArgumentIndexOffset = 1;
                   else if (args.length == 3)
                        nArgumentIndexOffset = 0;
                   else
                        printUsageAndExit();
                   nKey = Integer.parseInt(args[0 + nArgumentIndexOffset]);
                   nKey = Math.min(127, Math.max(0, nKey));
                   nVelocity = Integer.parseInt(args[1 + nArgumentIndexOffset]);
                   nVelocity = Math.min(127, Math.max(0, nVelocity));
                   nDuration = Integer.parseInt(args[2 + nArgumentIndexOffset]);
                   nDuration = Math.max(0, nDuration);
                   MidiDevice     outputDevice = null;
                   Receiver     receiver = null;
                   if (strDeviceName != null)
                        MidiDevice.Info     info = getMidiDeviceInfo(strDeviceName, true);
                        if (info == null)
                             out("no device info found for name " + strDeviceName);
                             System.exit(1);
                        try
                             outputDevice = MidiSystem.getMidiDevice(info);
                             outputDevice.open();
                        catch (MidiUnavailableException e)
                             if (DEBUG) { out(e); }
                        if (outputDevice == null)
                             out("wasn't able to retrieve MidiDevice");
                             System.exit(1);
                        try
                             receiver = outputDevice.getReceiver();
                        catch (MidiUnavailableException e)
                             if (DEBUG) { out(e); }
                   else
                        /*     We retrieve a Receiver for the default
                             MidiDevice.
                        try
                             receiver = MidiSystem.getReceiver();
                        catch (MidiUnavailableException e)
                             if (DEBUG) { out(e); }
                   if (receiver == null)
                        out("wasn't able to retrieve Receiver");
                        System.exit(1);
                   /*     Here, we prepare the MIDI messages to send.
                        Obviously, one is for turning the key on and
                        one for turning it off.
                   MidiMessage     onMessage = null;
                   MidiMessage     offMessage = null;
                   try
                        onMessage = new ShortMessage();
                        offMessage = new ShortMessage();
                        ((ShortMessage) onMessage).setMessage(ShortMessage.NOTE_ON, nChannel, nKey, nVelocity);
                        ((ShortMessage) offMessage).setMessage(ShortMessage.NOTE_OFF, nChannel, nKey);
                        /* test for SysEx messages */
                        //byte[] data = { (byte) 0xF0, (byte) 0xF7, (byte) 0x99, 0x40, 0x7F, 0x40, 0x00 };
                        //onMessage = new SysexMessage();
                        //offMessage = new SysexMessage();
                        //onMessage.setMessage(data, data.length);
                        //offMessage = (SysexMessage) onMessage.clone();
                   catch (InvalidMidiDataException e)
                        if (DEBUG) { out(e); }
                   *     Turn the note on
                   receiver.send(onMessage, -1);
                   *     Wait for the specified amount of time
                   *     (the duration of the note).
                   try
                        Thread.sleep(nDuration);
                   catch (InterruptedException e)
                        if (DEBUG) { out(e); }
                   *     Turn the note off.
                   receiver.send(offMessage, -1);
                   *     Clean up.
                   receiver.close();
                   if (outputDevice != null)
                        outputDevice.close();
              } catch (Throwable t) {
                   out(t);
              System.exit(0);
         private static void printUsageAndExit()
              out("MidiNote: usage:");
              out(" java MidiNote [<device name>] <note number> <velocity> <duration>");
              out(" <device name>\toutput to named device");
              out(" -D\tenables debugging output");
              System.exit(1);
         private static void listDevicesAndExit(boolean forInput, boolean forOutput) {
              if (forInput && !forOutput) {
                   out("Available MIDI IN Devices:");
              else if (!forInput && forOutput) {
                   out("Available MIDI OUT Devices:");
              } else {
                   out("Available MIDI Devices:");
              MidiDevice.Info[]     aInfos = MidiSystem.getMidiDeviceInfo();
              for (int i = 0; i < aInfos.length; i++) {
                   try {
                        MidiDevice     device = MidiSystem.getMidiDevice(aInfos);
                        boolean          bAllowsInput = (device.getMaxTransmitters() != 0);
                        boolean          bAllowsOutput = (device.getMaxReceivers() != 0);
                        if ((bAllowsInput && forInput) || (bAllowsOutput && forOutput)) {
                             out(""+i+" "
                                  +(bAllowsInput?"IN ":" ")
                                  +(bAllowsOutput?"OUT ":" ")
                                  +aInfos[i].getName()+", "
                                  +aInfos[i].getVendor()+", "
                                  +aInfos[i].getVersion()+", "
                                  +aInfos[i].getDescription());
                   catch (MidiUnavailableException e) {
                        // device is obviously not available...
              if (aInfos.length == 0) {
                   out("[No devices available]");
              System.exit(0);
    e
         *     This method tries to return a MidiDevice.Info whose name
         *     matches the passed name. If no matching MidiDevice.Info is
         *     found, null is returned.
         *     If forOutput is true, then only output devices are searched,
         *     otherwise only input devices.
         private static MidiDevice.Info getMidiDeviceInfo(String strDeviceName, boolean forOutput) {
              MidiDevice.Info[]     aInfos = MidiSystem.getMidiDeviceInfo();
              for (int i = 0; i < aInfos.length; i++) {
                   if (aInfos[i].getName().equals(strDeviceName)) {
                        try {
                             MidiDevice device = MidiSystem.getMidiDevice(aInfos[i]);
                             boolean     bAllowsInput = (device.getMaxTransmitters() != 0);
                             boolean     bAllowsOutput = (device.getMaxReceivers() != 0);
                             if ((bAllowsOutput && forOutput) || (bAllowsInput && !forOutput)) {
                                  return aInfos[i];
                        } catch (MidiUnavailableException mue) {}
              return null;
         private static void out(String strMessage)
              System.out.println(strMessage);
         private static void out(Throwable t)
              t.printStackTrace();

    Please post your code using code tags.
    When I try to compile or build i cant.What is your question? Exactly what error message do you get?

  • How can I run a java-application on starting of Windows 2000

    How can I run a java-application without any user on starting of Windows 2000?
    For example, if the computer is restarted and nobody enter into it yet, my java-application should run anyway.
    How can I do that?

    Hi, you have to put it in a Windows service.
    To do this you have a program, Srvany.exe that allow to insert a .exe or .bat program in a Windows service.
    For example, i develop a program, TomcatGuardian and i put it in a service because i need to run it in a server without Administrator logged in.
    Regards,
    Ivan.

  • How do i run a java program an another directory?

    How do I run a java program that's in a different directory?
    I have been doing this in the command line:
    java "C:\Document and Settings\freeOn\Desktop\Java\Test\test"
    and I get
    Exception in thread "main" java.lang.NoClassDefFoundError:
    C:\Document and Settings\freeOn\Desktop\Java\Test\test
    I just thought there might be a quick way to do this and not
    have to cd to the following dir evertime i want to run an app in
    console.
    The test.java file is this:
    import java.io.*;
    public class test {
        public static void main(String args[]) {
          System.out.println("Testing.....");

    Ok I looked in the java help and found the classpath, this makes it alittle easier.
    java -cp C:\DOCUME~1\freeOn\Desktop\Java\Test\ test
    At least i can run this in the run dialog which makes it easier thanks for you help kota balaji

  • How can I run external console program, printing output to JTextPane?

    How can I run external console program, printing output to JTextPane?
    I have a console app. written in C++ and I would like to run in it from java swing app. and I would like to see its output in a JTextPane.

    I have used this article
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
    to successfully pipe output from jboss batch files to a JTextPane.

  • How can i  apply this  java program for  a jsp page?

    import java.io.*;
    import java.util.*;
    public class FileProcessing
      //create a vector container  for the input variables
         Vector variables = new Vector();
      //create a vector container for the constants
         Vector constants = new Vector();
      /*create a string expression container for the equation
         as read from the file */
         String expression = " ";
      //create double result container for the final result
         double result = 0;
         public boolean processFile(String filename,String delim)
          //index for values vector
              int num_values = 0;
          //index for constants vector
              int num_constants = 0;
          //current line being read from the external file.
              String curline = " ";
          //start reading from the external file
              try
                   FileReader fr = new FileReader(filename);
                   BufferedReader br = new BufferedReader(fr);
                   while(true)
                        curline = br.readLine();
                        if(curline == null)
                             break;
                    //determine the type of current interaction
                        boolean variable = curline.startsWith("input");
                        boolean constant = curline.startsWith("constant");
                        boolean equation = curline.startsWith("equation");
                        boolean output = curline.startsWith("result");
                   //on input variables
                        if(variable)
                          StringTokenizer st = new StringTokenizer(curline,delim);
                          int num = st.countTokens();
                          int count=0;
                          while(st.hasMoreTokens())
                               String temp = st.nextToken();
                               if(count==1)
                                    byte b[]= new byte[100];
                                    System.out.println(temp);
                                    System.in.read(b);
                                    String inputval = (new String(b)).trim();
                                    variables.add(num_values,inputval);
                                    num_values++;
                               count++;
                        // on constant values
                        if(constant)
                             StringTokenizer st = new StringTokenizer(curline,delim);
                             int num = st.countTokens();
                             int count = 0;
                             while(st.hasMoreTokens())
                                  String temp = st.nextToken();
                                  if(count==1)
                                       byte b[]= new byte[100];
                                       System.out.println(temp);
                                       System.in.read(b);
                                       String cons = (new String(b)).trim();
                                       constants.add(num_constants,cons);
                                       num_constants++;
                                  count++;
                        // on equation
                        if(equation)
                             StringTokenizer st = new StringTokenizer(curline,delim);
                             int num = st.countTokens();
                             int count = 0;
                             while(st.hasMoreTokens())
                                  String temp = st.nextToken();
                                  if(count==2)
                                       this.expression = temp;
                                  count++;
              // now we are ready to evaluate the expression
                       if(output)
                          org.nfunk.jep.JEP  myparser= new org.nfunk.jep.JEP();
                          myparser.setAllowAssignment(true);
                          for(int i=1;i<variables.size()+1;i++)
                             String name = "arg"+Integer.toString(i);
                             myparser.addVariable(name,new Double(variables.get(i-1)
                                                .toString()).doubleValue());
                          for(int i=1;i<constants.size()+1;i++)
                               String name = "arg" +Integer.
                                         toString(i+variables.size());
                               myparser.addConstant(name,new Double(constants.get(i-1).toString()));
                   //output is obtained as follows
                          myparser.parseExpression(expression);
                          result = myparser.getValue();
                          System.out.println("Assay value: "+result);
              catch(Exception e)
                   System.out.println(e.toString());
              return true;
         public static void main(String[] args)
              FileProcessing fp = new FileProcessing();
              fp.processFile("input.eqn",":");
    }//my text file name is: "input.eqn" (given below)
    input:Enter Value1:arg1
    input:Enter Value2:arg2
    input:Enter Value3:arg3
    constant:arg4
    constant:arg5
    Equation:arg1+arg2+arg3
    result:

    how can i apply this java program for a jsp pagewhy do you want to do this ?
    Your program reads from a file on the disk and formats based on a patterm.
    Jsp is not intended for such stuff.
    ram.

  • How can i run the java bean sample program download from OTN

    hello to all
    i have a p[roblem. i have downloaded the sample progam from oracle web site which is a java code that connect with the oracle and shows a form. how can i run the from.
    can any body help me pleaSEEE
    thanks
    kamran ahmed                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Hi Darryl.Burke
    So your telling, we cannot run our Java Program when system shutdowns...In my application, when user has schedule for next days and he shutdown his PC. On the next day when System Started i should able to get back my schedule on the Specified time(I'm TimerTask class in Java)... How can i achieve this using Java? can u tell me clearly..

  • How can i run a java class file from shell?

    Hi all,
    I've a .class file named "File" that contains Main method, it is in the package "File2".
    How can I run it by shell command?
    PS: "java -cp . file" doesn't work it launch->
    Exception in thread "main" java.lang.NoClassDefFoundError: File2/File (wrong name: File2/File)
    Thanks in advance.

    Just to understand: is File2 ar jar archive or not? If it is a jar archive, have you tried open File2.jar? If File2 is a directory within the current directory, have you tried java -cp . File2/File? I just tested with a set of classes and it works... Let me be precise:
    * Let us imagine you are working in a directory whole path is PathToDir/
    * in this directory you have the classes put in a directory called File2
    * in order to launch File.class then you would have to invoke :
    cd PathToDir/ (just to be sure)
    java -cp . File2/File
    *if you were to do the following then you would have the problem you describe
    cd PathToDir/File2/
    java -cp . File

  • How can you get a java program working on a cell phone?

    I was thinking of making some stuff for cell phones so i was wondering how you get a normal java program to work on cells.

    its all j2me - midlet package....Huh? The jsr-118 MID profile alone has 11 packages, one of which is javax.microedition.midlet. Notj2me - midlet.
    works best on nokia phones.Sez who? You seem to be confusing Java ME with Symbian C.
    you can use net beans midlet packge add-on.Only it's called the NetBeans Mobiliity Pack.
    Its easy to use and has lots of tutorials.Ditto for the Wireless toolkit for CLDC.
    just search on google.Yes, but with which keywords?
    @OP:
    NetBeans mobility pack comes with a short tutorial and several samples, you also need to download the latest WTK as the ver. 2.2 which comes bundled with NetBeans is just too buggy to work with. Then there are the manufacturer-specific SDKs from Nokia, Motorola, Sony Ericsson and (maybe) others.
    If and when you get started in Java ME aka j2me, it will be appropriate to post any questions you might have on the mobility forums, not here.
    Google "j2me tutorial" for many good hits.
    luck, db

  • How can I use a Java program to write an executable Applescript

    I'm using a PC with Windows XP. I'm a private developer. I've written a project in Java and wish to deploy it to other people using email. I've written an Install program (the Main-Class) and successfully packed this in a jar file with the project class files and some data files all as described in the deployment trail in the Java Tutorials. A recipient with a Mac with OS X downloads the jar file and runs it to install the project class files and some data files. The install program then writes an Applescript file (Vocab.scpt shown below) on the Desktop to make starting my downloaded program easier but it doesn't seem to work and I think it may be because the script file is not "executable". Could this be the case? If so, how could I change my install program to make the script file executable or alternatively use some other system to start the downloaded program?
    Vocab.scpt:-
    # Script to start: Vocab Version: 1.0.0
    do shell script "cd /Applications/Vocab; Java Vocab"
    Many thanks for your interest. Unfortunately I don't have a Mac to experiment with this problem and although I have spent some days on and off trying to find an answer in the mass of information available on Apple's website I can only find small clues here and there to answer my problem (which I would have thought was quite a common one). In Windows a batch file (eg. Vocab.bat) is automatically executable.

    I didn't expect you to have your customer run the command. I would expect you to create the executable and install it. However, there wouldn't be any difference in what you are creating and the .jar file. Either way it is a faceless icon. For that matter, it is no different than a batch file on Windows. I'm not sure what they wouldn't understand with, "copy the Vocab.jar file to wherever you want and double-click it to run the program." In addition, you probably ought to point out that Java is not installed on Mac OS X Lion (10.7.x) and when they double-click the jar file (or whatever you send them), the system will ask if they want to install Java.
    What you really need to do is package up the app inside a Mac application package and provide the user with the application on a .dmg (disk image). Take a look here: http://developer.apple.com/library/mac/#documentation/Java/Conceptual/Jar_Bundle r/Introduction/Introduction.html#//apple_ref/doc/uid/TP40000884
    I also found this which uses ANT to create the bundle: http://informagen.com/JarBundler/

  • How can I run an external program from a PLSQL procedure?

    Is there a package to run an external program from PLSQL? or is there another way to do that?
    thanks.

    here there is an example about how a PL/SQL procedure can
    work with an external C program.
    http://download-east.oracle.com/docs/cd/A87860_01/doc/appdev.817/a76936/dbms_pi2.htm#1003384
    Apart from that you have Java Stored Procedures option
    to carry out your task.
    Java Stored Procedures Developer's Guide Contents / Search / Index / PDF
    http://download-east.oracle.com/docs/cd/B10501_01/java.920/a96659.pdf
    Joel P�rez

  • Can I run my java program in windows environment?

    How can i make my compiled java program run into windows environment?
    What program will i use to be able to do that?

    1. Install the JRE.
    2. Go to the command line.
    3. Type something like java myClass or java -jar myJar.jar.
    You could also use one of the many java2exe (java to executable) programs floating out there.

  • How can I run the C program which will interact with user

    hi, all
    I wanna run a C program whose function is that just show a line of characters, waiting for user input and finally show what user has entered. The C can run correctly in command window. But when I use Runtime class, it can not run correctly. My question is that how I can emulate that C program just by invoking Java method. The code I have written below, thank.
          String command = "cmd /c a.exe";  // a.exe is that C program
          String s;
          try {
             Process process = Runtime.getRuntime().exec(command);
             InputStream input = process.getInputStream();
             BufferedReader bufferedReader =
                new BufferedReader(new InputStreamReader(input));
             while((s = bufferedReader.readLine()) != null)
                  System.out.println(s);
          catch(IOException e) {
             System.err.println("IOException: " + e.getMessage());
          }

    http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Process.html#getOutputStream()

Maybe you are looking for