How to output executable Bin file under linux from java

Hi
im beginner in java under linux and i want to out put my java programs to be bin files that can run
if this not possilble
how to run the output jar files with just double click ?
does i have to run sh file that do the hob how?
thanks in advance.

say your main method (application's entry point) is located in a class com.my.Class,
then first you create a text file (say, manifest.txt) that contains this line:
Main-Class: com.my.Class
[/code}
and then you append this to the jar's manifest as such:
jar cfm yourjarfile.jar manifest.txt [additional files you might want to add]
for more info,
http://java.sun.com/docs/books/tutorial/deployment/jar/manifestindex.html                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • How to run SQL script file on Linux using Java ?

    Hi,
    I need to execute .sql file using java. I used following approach for this.
    private void runScriptEvent(java.awt.event.ActionEvent evt) {                               
            String sqlOutput = "";
            String sqlPromptLines="";
            String currentFunctionName = "";
            if(con!=null){
                String userName = jTextField4.getText();
                String password = jPasswordField1.getText();
                String databaseName = jTextField3.getText();
                try {
                    String script_location = "";
                    ProcessBuilder processBuilder =null;
                    Process process = null;
                    //File file = new File("C:/ScriptFile");
                    File file = new File("./SQL_Script");
                    //File file = new File("E:\\install\\SQL_Script");
                    if(file.exists()){
                        File [] list_files= file.listFiles(new FileFilter() {
                                        public boolean accept(File f) {
                                        if (f.getName().toLowerCase().endsWith(".sql"))
                                        return true;
                                        return false;
                    int count = 0;
                        for (int i = 0; i<list_files.length;i++){
                            script_location = "@" + list_files.getAbsolutePath();//ORACLE
    //currentFunctionName = list_files[i].getName();
    StringTokenizer st = new StringTokenizer(list_files[i].getName(), ".");
    while(st.hasMoreTokens()) {
    currentFunctionName = st.nextToken();
    String extention= st.nextToken();
    System.out.println("Function Name = "+currentFunctionName + "\t Extention = " + extention);
    processBuilder = new ProcessBuilder("sqlplus",userName+"/"+password+"@"+databaseName, script_location); //ORACLE
    processBuilder.redirectErrorStream(true);
    process = processBuilder.start();
    BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream()));
    String currentLine = null;
    while ((currentLine = in.readLine()) != null) {
    sqlPromptLines = " "+sqlPromptLines + currentLine +"\n";
    count ++;
    System.out.println(count+" " + currentLine);
    if(currentLine.equalsIgnoreCase("Function created.")){
    sqlOutput = "\n" sqlOutput currentFunctionName + " " currentLine"\n" ;
    break;
    }// end while
    in.close();
    process.destroy();
    }//end for
    }//end if file exists
    } catch (IOException e1) {
    jTextArea1.setText(e1.getMessage());
    System.out.println("Script Done");
    jTextArea1.append(sqlOutput);
    }// end id Connection is not null
    Above code working appropriate on Windows but not on Linux.
    is there any changes needed ?
    Regards,
    Ajay
    Edited by: Ajay Sharma on Nov 21, 2012 6:43 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Hi gimbal2,
    about code
    jTextArea1.setText(e1.getMessage());I am using this code so that the user will be prompted with a message rather than stack trace.
    About the issue I am getting on linux i believe its because of following statement.
    processBuilder = new ProcessBuilder("sqlplus",userName+"/"+password+"@"+databaseName, script_location); //ORACLERegards,
    Ajay
    Edited by: Ajay Sharma on Nov 23, 2012 12:05 PM
    Edited by: Ajay Sharma on Nov 23, 2012 12:06 PM

  • How To Change Resource Bundle file's data from Java Class

    Hi
    i have used below code for accessing Resource Bndle from Java Class but here i also want to make change in a particular key and its value.
    please let me know the code i should use to make changes in Resource Bundle file's key and value and saving the same in the file.
    package test;  import java.util.Enumeration;
    import java.util.ResourceBundle;
    public class ResourceBundleTest {
    public static void main(String[] args) {
    ResourceBundle rb = ResourceBundle.getBundle("test.bundletest.mybundle");
    Enumeration <String> keys = rb.getKeys();
    while (keys.hasMoreElements()) {
    String key = keys.nextElement();
    String value = rb.getString(key);
    System.out.println(key + ": " + value);
    Thanks

    With further debugging, I noticed the following line only works in integrated WLS but not in standalone WLS
    resourceBundle = ResourceBundle.getBundle("com.myapp.MyMappings");
    I confirmed the corresponding properties file was included properly in the EAR file but the standalone WLS failed to find the properties file at runtime.
    Why did the standalone WLS class loader (must be the same as the integrated WLS) failed to find the properties file deployed under the WEB-INF/classes path in the EAR file?
    The above line was in a POJO class which has the same classpath as the properties file ie. com.myapp.MappingManager.class.
    It was strange that the class loader could load the POJO class but unable to find the com.myapp.MyMappings.properties in the same classpath!!!
    Is this a bug in standalone WLS?
    Edited by: Pricilla on May 26, 2010 8:52 AM
    Edited by: Pricilla on May 26, 2010 9:01 AM

  • How do I select multiple files under "Get File Info"and lock or unlock all?

    How do I select multiple files under "Get File Info"and lock or unlock them all? It seems to do it automatically when I have 10 or more selected. But how do I lock or unlock 5 or 6 files in one swoop? Thanks

    Select the desired files then press OPTION and select Show Inspector from the Finder's File menu.
    Why reward points?(Quoted from Discussions Terms of Use.)
    The reward system helps to increase community participation. When a community member gives you (or another member) a reward for providing helpful advice or a solution to their question, your accumulated points will increase your status level within the community.
    Members may reward you with 5 points if they deem that your reply is helpful and 10 points if you post a solution to their issue. Likewise, when you mark a reply as Helpful or Solved in your own created topic, you will be awarding the respondent with the same point values.

  • How to create executable jar files??

    how to create executable jar files??
    thx :)

    Using JAR Files to Deploy
    http://developer.java.sun.com/developer/onlineTraining/Programming/BasicJava2/jar.html#jar

  • How to upgrade ( touchsmart 610-1130f ) under Linux Operating System: Ubuntu 10.11

    How to upgrade ( touchsmart 610-1130f ) under Linux Operating System: Ubuntu X11
    Unfortunatly didn't do it before erasing Win Se7en.

    I got the answer: If your operating systemt is not listed, we don't have upgrade for you.  If I knew that I woud'nt buy a HP computer.

  • How to upgrade ( touchsmart 610-1130f ) under Linux Operating System: Ubuntu 11.10

    How to upgrade ( touchsmart 610-1130f ) under Linux Operating System: Ubuntu 11.10
    Options 
    How to upgrade ( touchsmart 610-1130f ) under Linux Operating System: Ubuntu X11
    Unfortunatly didn't do it before erasing Win Se7en.

    I got the answer: If your operating systemt is not listed, we don't have upgrade for you.  If I knew that I woud'nt buy a HP computer.

  • How to run a .bin file?

    I need to upgrade my router to be compatible with Win 7.  However, I have no idea how to open a .bin file.  Can anyone help me?
    Thanks,

    I agree with GV, you don't need to open the firmware file (.bin). There is a certain procedure to upgrade that firmware file on your Router... Follow the steps bellow...
    Open an Internet Explorer browser page on a computer hard wired to the router...In the address bar type - 192.168.1.1...Leave the Username blank & in Password use admin in lower case...
    Click on the 'Administration' tab- Then click on the 'Firmware Upgrade' sub tab- Here click on 'Browse' and browse the .bin firmware file and click on "Upgrade"...Wait for few seconds until it shows that "Upgrade is successful"  After the firmware upgrade, click on "Reboot" and you will be returned back to the same page OR it will say "Page cannot be displayed".
    Now reset your router :
    Press and hold the reset button for 30 seconds...Release the reset button...Unplug the power cable from your router, wait for 30 seconds and re-connect the power cable...Now re-configure your router...

  • Problem of executing a process under Linux using Runtime.exec

    Hi, All
    I am having a problem of executing a process under Linux and looking for help.
    I have a simple C program, which just opens a listening port, accept connection request and receive data. What I did is:
    1. I create a script to start this C program
    2. I write a simple java application using Runtime.exec to execute this script
    I can see this C program is started, and it is doing what it supposed to do, opening a listening port, accepting connection request from client and receiving data from client. But if I stop the Java application, then this C program will die when any incoming data or connection request happens. There is nothing wrong with the C program and the script, because if I manually execute this script, everying works fine.
    I am using jre1.4.2_07 and running under Linux fedora 3.0.
    Then I tried similar thing under Windows XP with service pack2, evrything works OK, the C program doesn't die at all.

    Mind reading is not an exact science but I bet that you are not processing either the process stdout or the stderr stream properly. Have you read http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html ?

  • How to Launch an Integration Builder under two different java versions

    How to Launch an Integration Builder under two different java versions     1
    1. Situation     2
    2. How To Do     2
    2.1 jre preparation     2
    2.2 Put them into the system     2
    2.3 Execute a Java Web Start under jre 1.4.x version     3
    2.4 Change Java Runtime Versions     3
    2.5 Launch an Integration Builder     6
    1. Situation
    OS: windows 2000 pro – English
    Java version: jdk 1.5.x was already installed. (It’s not permitted to change.)
    I don’t have any authorization to install any software on the PC.
    But I need to use an Integration Builder.
    I already knew URLs of an Integration Builder (http://<hostname>:50000/rep/start/repository.jnlp).
    2. How To Do
    At this moment, an Integration Builder (XI 3.0) can be launch under jre 1.4.x environment (on windows).
    2.1 jre preparation
    I download j2re-1_4_2_10-windows-i586-p.exe from http://java.sun.com/j2se/1.4.2/download.html
    I installed it on my home PC and copied all files from C:\Program Files\Java\ j2re1.4.2_10\ into my USB.
    2.2 Put them into the system
    I pasted j2re1.4.2_10 folder from my USB into the windows 2000 pro system.
    Finally, I could list up all of javaws.exe under this system.
    c:\j2re1.4.2_10\javaws\javaws.exe
    c:\Program Files\Java\jdk1.5.0_05\bin\javaws.exe
    c:\Program Files\Java\jdk1.5.0_05\jre\bin\javaws.exe
    c:\Program Files\Java\jre1.5.0_05\bin\javaws.exe
    2.3 Execute a Java Web Start under jre 1.4.x version
    I executed c:\j2re1.4.2_10\javaws\javaws.exe .
    2.4 Change Java Runtime Versions
    Go to File-> Preferences -> Java
    As you can see, it indicates 1.5 version.
    Click [FIND] button.
    Click [NEXT] button.
    Click the j2re1.4.2_10 folder.
    Click [NEXT] button.
    A JRE Finder is able to find javaw.exe automatically. Or you can indicate C:\j2re1.4.2_10\bin\javaw.exe directly.
    Click [NEXT] button.
    Finally, there are two Java Runtime Versions. Now you need to uncheck the Enabled column of 1.5 version and check 1.4 version.
    Click [OK] button.
    Well, in the General tab, I selected None for Proxies.
    2.5 Launch an Integration Builder
    In the Location field, I typed the URL of an Integration Builder jnlp.
    http://<hostname>:50000/rep/start/repository.jnlp
    SAP Integration Builder comes up inside Applications area.
    Select it and click [Start] button.
    If you click Environment-> Integration Builder (Configuration), you can launch Integration Builder: Configuration.
    [PDF file location] with screenshots
    http://SDN.mobilian.org/SDN/How2LaunchIB.rar
    ===================Advertisement==========================
    How do you search SDN?
    What about [<b>SDN Search Widget</b>]?
    SDN Search Widget
    =========================================================

    I am not getting anywhere with deploying my application or
    applet.
    I have set up my bc4j project. It contains all my VO info,
    links, application module. (proj a)
    I then have another project with DbInfo in it(has all my rowset
    info), Multiple Frames, and my Applet.java file.
    Actually I have an Applet.java file and a Application.java file
    because I was seeing if both/either worked. Anyway they seem the
    same, except for that extra window that comes up when you run the
    applet.
    I follow the steps in the oracle directions (from earlier post).
    And all seems ok. But at ---->
    [*] Select the subdirectory under myhtml where your applet's HTML
    file
    is located, and enter the directory path of the 'staging'
    directory you
    created in step 3 above, if different from the default.</li>
    [*]Select the HTML files that JDeveloper created to run your
    applet.</li>
    [*]Select all of the Java source files in your project that make
    up the
    applet.</li>
    I have no HTML file associated with my applet, at least that I
    know of.
    So do I need to create one, or should it of been done
    automatically.
    Also, I trying to figure out what will be the best way to deploy
    my project. Applet or stand alone application is what my first
    choices have been so far. I have read that there is some issues
    with applets being served from a different server than the
    database. So a stand alone application was my front runner, but
    I haven't gotten either way to work yet.

  • Open a PDF file in linux using java

    Hi..
    How can I open a PDF file in linux using java.
    I am able to open PDF in windows and mac using this code
    in Windows
    Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + path_of_PDF);
    in mac
    Runtime.getRuntime().exec("open " + path_of_PDF);
    But nothing is working with linux.
    Please help
    Thanks

    One thread is enough:
    http://forum.java.sun.com/thread.jspa?threadID=5267458

  • Open PDF file in linux using java

    Hi..
    How can I open a PDF file in linux using java.
    I am able to open PDF in windows and mac using this code
    in Windows
    Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + path_of_PDF);
    in mac
    Runtime.getRuntime().exec("open " + path_of_PDF);
    But nothing is working with linux.
    Please help
    Thanks

    appi wrote:
    Hi.. I found the JDIC binary files. There are different binaries for all the plateform. Is there any solution which is independent of plateform.Yes, and we already told you: Use JDK6, which has those libraries built into the standard class library.
    How can I use these binaries in my existing project. does it work, If I place them at same place where other .class files are kept.Read the documentation of the JDIC project. I'm sure they answer this question in their FAQ.

  • How can i build RPMs file for my own Java Application?

    How can i build RPMs file for my own Java Application?....I have my own directory that contains all Java Source files and some files that my Application required....I want to build RPMs file like a install File to Linux System, Now my OS is Linux Fedora core 1.....How can i do this?

    I think that in order to create a RPM, you'd need to
    use some C.Nope - the RPM is all about packaging and the "magic" x.spec file. You can have anything you want in the RPM, but you have to use RPM tools to build the .rpm file. One of the features is that you can also indicate (via "install" scripts) modifications to other files or the filesystem to support the installation of whatever's in the RPM.

  • How can i execute excelsheet without giving path in java

    Hi,
    How can i execute excelsheet without giving path in java, through this code, you can open the notepad but
    I want whereever the excel is installed in your machine , fine and open excelsheet without given absolute path.
    class ExecuteCommand{
    public static void main(String d[]){
         Runtime r = Runtime.getRuntime();
         Process p= null;
         try{
         p = r.exec("notepad");
              catch(Exception e){
                   System.out.println("error");
    If you know please send me your idea and code samples.
    regards
    Mohan kumar

    just execute the exelfile with the Windows "start" command:
    Runtime.exec("cmd /c start "+excelFileName);But this requires that Excel is the default application for the Excel file type (*.xls). You can test this by simply typing "start myTestExcel.xls" in a dos box.

  • How do I know what files to remove from my Macbook Pro laptop?

    Apparently my hard drive is full and I need to remove files so I have space to download more music and movies.  I don't want to delete important files.  How do I go about doing this? 

    How do I know what files to remove from my Macbook Pro laptop?
    Remove only files you yourself stored on the laptop; files in your Home folder. Don't delete any files from the system libraries, and if you want to remove applications, use the provided uninstallers.
    For files in the media libraries - iTunes, iPhoto, iMovie use the application to delete music, photos, movies.
    If you are planning on storing more movies and music on your mac, deleting old files will probably not suffice alone to free enough space. Consider to get yourself an external drive to store your media.

Maybe you are looking for