Executing Java Application...

Hi,
Just wanted to know, is there any way to make our java/swing program executable by double clicking it? One of the ways I am using is to create a jar file with all the swing classes inside. But I realised that I can open the jar file using winzip and extract all the classes. The problem is I don't want people to view my java source and classes. We can decompile the class files into java source using java decompiler. I don't want people to read my sources. Any ways to do it? Thanks in advance.
Dreon

Hi, thx for ur reply. Do i really need to create dat .bat file since I can execute the program by double
clicking the .jar file? Actually, i am more interested to know how to hide my .class files or .java files
from the users. Now i understand why we can't make it executable. thx :)You can do a search on Google for Java and Obfuscators, which are programs that would make it more difficult for one to "reverse" engineer or decompile your code... But even an *.exe file is vulnerable to decompilating and "reverse" engineering...
Also, when creating a Jar, you only need the class files ( *.class), the *.java files are only uncompiled source code and can be left out...since they are not necessary to run you application
You can if you want have your source ( *.java ) packaged in another jar or zip file if you want to share it with another trusted programmer or friends... but that's up to you...
And finally, there is no need to use a batch file ( *.bat ) if you create a Jar. Unless you application does not have a GUI and requires you to run it in the Command Prompt...
The Jar file works just like an executable ( *.exe ). Double click and "Boom", your application is running... And you can create your Shortcuts to point to the Jar file...
Any way, have fun...
- MaxxDmg...
- ' He who never sleeps... '

Similar Messages

  • Executing Java Application in another machine

    Hi all,
    I am programming a Java application which will eventually run in a different machine. This application uses the Communications API, so I wonder if it is necessary that the destination machine has the javax.comm.property and win32com.dll files installed. In that respect, the target machine will have a certain version of JRE installed, in which folders should I install those files.
    Having said that, I would appreciate if someone could also enumerate good practices to ensure an application will successfully run on different machines
    Regards.

    My problem is that if there is a new PC , nothing installed in it, can I launch a java application in it ?
    My friend asked me if I can build an application in java which I can use in any PC and the application will do something like an installation. In fact he wants to know if java can build an installation like application which will install for example a software on a new PC.
    I think I told you more clearly the situation.

  • How to develop JMS Java Application.

    Now,I develop Java Application(J2SE stand alone) to send JMS for JMS Adapter(sender) verification.
    But fatal exception is displayed when I execute Java application.
    Error is rellated to following code.
    InitialContext context = new InitialContext(properties); //←(SendJMS.java:41)
    Are there wrong points in this code or other necessary settings(for example on Visual administrator) ?
    I think that Java Appli can send Java Message to JMS provider in J2EE(XIserver) by using JNDI.
    Is my thougt wrong?
    Sorry poor English.
    Best regards.
    (Java code)
    Created on 2007/09/06
    To change the template for this generated file go to
    Window>Preferences>Java>Code Generation>Code and Comments
    package jmsPackageS;
    import java.util.Properties;
    import javax.naming.*;
    import javax.jms.*;
    @author sakurai.youkou
    To change the template for this generated type comment go to
    Window>Preferences>Java>Code Generation>Code and Comments
    public class SendJMS {
         public static void main(String[] args) {
              try {
                   //1.JNDI server connection
                   //JNDI server connection property settings
                   java.util.Properties properties = new Properties();
                   properties.put(
                        Context.INITIAL_CONTEXT_FACTORY,
                        "com.sap.engine.services.jndi.InitialContextFactoryImpl");
                   //JNDI server URL
                   properties.put(Context.PROVIDER_URL, "xidevelp:50004");
                   //JNDI login data
                   //properties.put(Context.SECURITY_PRINCIPAL, "J2EE_ADMIN");
                   //properties.put(Context.SECURITY_CREDENTIALS, "mypassword");
                   //start initial context with the properties specified
                   InitialContext context = new InitialContext(properties); //(SendJMS.java:41)
                   //2.Register the connection factory
                   QueueConnectionFactory queueConnectionFactory =
                        (QueueConnectionFactory) context.lookup(
                             "jmsfactory/default/QueueConnectionFactory");
                   //3.Specify the connection type                //JMS provider connection
                   QueueConnection queueConnection =
                        queueConnectionFactory.createQueueConnection();
                   //4.Start the connection
                   //start the connection of Queue type
                   queueConnection.start();
                   //5.Create session
                   //create session of Topic type
                   QueueSession queueSession =
                        queueConnection.createQueueSession(
                             false,
                             Session.AUTO_ACKNOWLEDGE);
                   //6.Create or look up a destination
                   //create destination of Queue type
                   //Queue queue = queueSession.createQueue("Example_destination_name");
                   //look up a destination of Queue type
                   Queue queue =
                        (Queue) context.lookup("jmsqueues/default/sapDemoQueue");
                   //7.sender
                   // create subscriber to a queue
                   QueueSender queueSender = queueSession.createSender(queue);
                   //8.Send message contents
                   TextMessage textMessage = queueSession.createTextMessage();
                   textMessage.setText("Test");
                   //send message
                   queueSender.send(textMessage);
                   //sending message
                   String messageText = textMessage.getText();
                   System.out.println("Send Message text: " + messageText);
                   //Final.close
                   //closes the jms queue session
                   queueSession.close();
                   //Close the queue connection
                   queueConnection.close();
              } catch (NamingException ne) {
                   System.out.println("NamingException: " + ne);
              } catch (JMSException jmse) {
                   System.out.println("JMSException: " + jmse);
              } catch (Exception e) {
                   System.out.println("Error");
    (error message)
    java.lang.NoClassDefFoundError: com/sap/exception/IBaseException
         at java.lang.ClassLoader.defineClass0(Native Method)
         at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
         at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
         at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
         at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
         at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Class.java:219)
         at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:42)
         at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:649)
         at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
         at javax.naming.InitialContext.init(InitialContext.java:219)
         at javax.naming.InitialContext.<init>(InitialContext.java:195)
         at jmsPackageS.SendJMS.main(SendJMS.java:41)

    Hi Yoko
    have look at  this troubleshooting Pdf's
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/1706a7e3-0601-0010-b4b6-c5641cccc920
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3a83c242-0801-0010-dc95-d496cf6dba9d
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/bd5950ff-0701-0010-a5bc-86d45fd52283
    Thanks !!!

  • How To install Java Application[J2SE] into Windows Mobile

    Hi All,
    I have developed an application for Mobile devices[ Windows Mobile] exclusively using Java[AWT].When I try to install , the application in mobile, i got the following error.
    *"MIDlet cannot be installed because critical information is missing from the MIDlet file (.jar). - 13 Please contact the MIDlet provider for more information."*
    I didnt use any midlet classes in my application. So my question is, what the above error denotes? and How to install
    java[AWT] application into mobile?. What are all the requirements to install the application?.
    Thanks in advance.

    Hi David, thank you very much, your information was very useful, finally i got the work done.
    The problem was with the JVM which is im used in my Windows Mobile. And im installed CrE-ME in my mobile
    to execute java application.
    The following link has the details of how to install the JVM and execute the aplication (.jar ).
    http://javatolearn.blogspot.com/search/label/Java%20in%20Windows%20CE%20with%20CrE-ME
    Thanks and Regards
    Baskaran

  • How can I execute an IE browser window from within my java application?

    I am programming a java application that requires me to execute a browser application and point to a specific web site. How can I do this? I cannot seem to find any examples on the web.

    Hi Heals,
    This forum is for discussing Measurement Studio for Visual Basic and is not really a good place to ask general purpose Java questions. I suggest searching one of the comp.lang.java.* newsgroups at http://groups.google.com/.
    Off the top of my head, though, I would say take a look at the Runtime.exec method.
    - Elton

  • We are trying to implement a process so that any document that needs to be printed through our Java application will be printed as PDF using Adobe Reader. For which, We created and execute the below command line to call Adobe Reader and print the PDF on a

    We are trying to implement a process so that any document that needs to be printed through our Java application will be printed as PDF using Adobe Reader. For which, We created and execute the below command line to call Adobe Reader and print the PDF on a printer."C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe" /T "\\<Application Server>\Report\<TEST.PDF>" "<Printer Name>". Current Situation: The above command line parameter when executed is working as expected in a User's Workspace. When executed in a command line on the Application Server is working as expected. But, the same is not working while executing it from Deployed environment.Software being used: 1. Adobe 11.0 enterprise version. 2. Webshpere Application Server 8.5.5.2. Please let us know if there is a way to enable trace logs in Adobe Reader to further diagnose this issue.

    This is the Acrobat.com forum.  Your question will have a much better chance being addressed in the Acrobat SDK forum.

  • How can I execute a  .bat  file from inside a java application

    I have a .bat file which contains an executable file(.exe) and some input and output file names. What commands can I use to execute this bat file from my java application.

    After raeding tkleisas' reply; i am trying to invoke another application (which can be invoked from the command line) by using a batch file and trying Runtime.exec for executing a batch file.
    My current code is:
    Runtime runtime = Runtime.getRuntime();
    Process trialProcess;
    trialProcess = runtime.exec("cmd.exe /C start C:\\guns.bat /B");
    And my guns.bat looks like:
    cd C:\CALPUFF
    echo trial
    start calpuff.exe CALPUFF.INP
    This is not working for me and i get the following in the error stream of the trialProcess:
    Error :
    The system cannot execute the specified program.
    Process finished with exit code 1
    Has anyone come across something like this and know what's wrong with this one??
    thnx

  • Execute DOS command from java application

    Hello,
    I want to execute a DOS command (MOVE, in order to move an image from a folder to an other) from a java application. How can I do this?
    Francesco

    Yes I have tested it and it is working but only when executing a bacth file. For instance:
    Runtime rt = Runtime.getRuntime();
    try{
         Process proc = rt.exec("move.bat");
    }catch(Exception ex){
         ex.printStackTrace();
    }and the command in move.bat is:
    move c:\\temp\\*.gif C:\\temp2
    You don't have to use double slashes in batch files, only in Java. But anyway it is working both ways.
    It is not working when you try to execute the command without the batch file:
    Process proc = rt.exec("move c:\\temp\\*.gif C:\\temp2"); -> this will not work.
    It should work. Try to execute another command to see what happens.

  • Error when I execute an application with the java command in a DOS prompt

    Hi:
    I have a trouble. I edit the most simple program in Java: hello.java
    In DOS prompt, I compile the program. The result is the file hello.class
    c:\> javac hello.java
    However, I try to execute this program with the command java
    c:\> java hello
    and the DOS prompt send me an error like this: Java.exe has a problem and must be closed.
    I press the option "Don't send". After this, the DOS prompt returns empty and it doesnt execute the application:
    c:\>
    By the way, in an IDE editor like Gel, the file hello.java is compiled and executed correctly without problems.
    I edited other simple Java files, I compiled them succesfully and I can't run them in a DOS pormpt. The result is the same dialog box: "Java.exe has a problem and must be closed".
    The question is: Why don't these programs run in a DOS prompt?
    My Operating System is Microsoft Windows XP and the Java compiler version is: 1.6.0_13
    Thanks in advanced.

    Hi again:
    What happens when you type "java -version"?
    Answer:
    java version "1.2"
    Classic VM (build JDK-1.2-V, native threads)
    What is the value of your %PATH%?
    Answer:
    Path=E:\oracle\product\10.2.0\db_1\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Archivos de programa\Archivos comunes\Adaptec Shared\System;C:\Archivos de programa\Executive Software\DiskeeperLite\;C:\Archivos de programa\QuickTime\QTSystem\;C:\Archivos de programa\Java\jdk1.6.0_13\bin;C:\Archivos de programa\Microsoft SQL Server\80\Tools\Binn\;e:\Microsoft SQL Server\90\Tools\binn\;C:\BITWARE\;C:\Archivos de programa\Archivos comunes\Ahead\Lib\
    PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
    Have you considered running Linux?
    Answer: No, because Linux is more complex.
    Additional information:
    My Operating System is: Microsoft Windows XP Profesional Version 2002, Service Pack 3, running on an Intel Pentium 4, CPU 2.4 Ghz, RAM: 2.23 Gb

  • Executing any other applications from a java application

    how can i execute or invoke other applications on the pc
    from a java application?

    Runtime.getRuntime().exec("dir");

  • How to execute any cmd command from java application?

    Hi all,
    How to execute or call any command of cmd from java application??
    Is there any method to do so??
    Or, is it possible to do it using Runtime.exec() ??? And if so, how to use it, please explain with ab example...
    I'll highly appreciate....
    Thank you.

    If google would be the best option, then I would not be on Sun's forums and I would not have asked experts like you, sir !! :-)
    Neway, I got the solution from PhHein !!
    Good link indeed..
    Cheers..

  • Can I execute MySql's command from java application?

    Can I execute MySql's command from java application? And how?
    For example :
    load data local infile 'D:\\myData.txt'
    into table myTable
    fields terminated by ';'
    lines terminated by '\n';

    1. get the jdbc driver for mysql from the mysql site at: http://dev.mysql.com/downloads/connector/j/5.0.html
    2. follow the installation instructiions... which you'll also find in your mysql manual...
    Happy travels. Keith.

  • Steps to execute servlets on Sun Java Application Server

    Hi
    Could u tell me how to deploy servlets files and how to execute
    In specs. the ask us to start cloudscape database server
    In my Sun Java Application Server installations, i am not find even a single name as cloudscape
    Please anyone guide me get the servelts to execute
    thank u

    What specs do you refer to?
    Sun Java System Application Server does not include Cloudscape, nor is it required. SJSAS does include a development copy of Pointbase DB Server.
    To deploy your servlet application you will need to package them into a WAR file (Web Archive). Then you can either use asadmin CLI or the admin gui to deploy the WAR. The steps are included here: http://docs.sun.com/source/816-7150-10/dwdeploy.html
    Now I'm going to assume you application uses Cloudscape. To get that piece running you will need to download and install Cloudscape. You will also need the JDBC drivers for Cloudscape. Copy the JDBC driver jar file to either the <serverinstancedir>/lib directory or modify the JVM settings to include that jar file. Restart the Application Server. You will also need to add a JDBC Resource & Connection Pool. In the admin, create a new connection pool (probably called Cloudscape). Use the appropriate settings for classname and add any additional properties that are necessary (Usually URL, User, Password). Now create a JDBC Resource using that Connection Pool. Make sure the JNDI name matches what your application expects.
    Now just access the URL for the application
    -Jeff

  • How to execute a java application once the server starts

    I have created a java application which executes correctly. I want this application to execute everytime I start my server. I have modified my web.xml as shown below
    <servlet>
    <servlet-name>SendEmail</servlet-name>
    <servlet-class>
    com.allcorp.alliance.tdocs.servlets.SendEmail</servlet-class>
    <init-param>
    <param-name>config</param-name>
    <param-value>/WEB-INF/struts-config.xml</param-value>
    <load-on-startup>1</load-on-startup>
    </init-param>
    </servlet>
    I have extended the class with HttpServlet. When I start the server, I get the message saying the class is being initializing but it does not execute. I want the application to execute. Any idea what I need to do.

    BalusC wrote:
    Implement ServletContextListener and run the appplication on creation of the ServletContext.Well i understand implementation of ServletContextListener and by overiding contextInitialized(ServletContextEvent se) accordingly can solve the problem.
    but you need to consider two cases here first
    1).ServletContextListener is not supported by all container especially the minor onces which does not support Servlet 2.3 specification.
    2).OP does not have any idea of how to use a Servlet first if you can see he had written his intialization code in the main method.Now how can you expect him to create a listener..... :)
    I hope there are no hard issues on what i said this time.
    *@OP*
    My friend the bad news is that you need to spend bit of time learning about servlets.U'd not be writing intialization code inside a main rather you'd be doing it inside public void init(ServletConfig config) method.
    by making <load-on-startup><!--value</load-on-startup> in web.xml enables Servlet container to call init method at the time of deployment of the web application else where it'd call the init method whenever servlet encounters first request from a client.
    package com.allcorp.alliance.tdocs.servlets;
    import java.util.*;
    import javax.mail.*;
    import javax.mail.internet.*;
    import javax.servlet.http.*;
    import javax.servlet.*;
    import javax.activation.*;
    * @author ssa3z
    * TODO To change the template for this generated type comment go to
    * Window - Preferences - Java - Code Style - Code Templates
    public class SendEmail extends HttpServlet{
    public void init(ServletConfig config) {
        // SUBSTITUTE YOUR EMAIL ADDRESSES HERE!!!
        String to = "[email protected]";
        String from = "[email protected]";
        // SUBSTITUTE YOUR ISP'S MAIL SERVER HERE!!!
        String host = "smtp.allstate.com";
        // Create properties, get Session
        Properties props = new Properties();
       // If using static Transport.send(),
      // need to specify which host to send it to
      props.put("mail.smtp.host", host);
      // To see what is going on behind the scene
      props.put("mail.debug", "true");
      Session session = Session.getInstance(props);
      try {
         // Instantiatee a message
         Message msg = new MimeMessage(session);
         //Set message attributes
         msg.setFrom(new InternetAddress(from));
         InternetAddress[] address = {new InternetAddress(to)};
         msg.setRecipients(Message.RecipientType.TO, address);
         msg.setSubject("Test E-Mail through Java");
         msg.setSentDate(new Date());
         // Set message content
         msg.setText("This is a test of sending a " +"plain text e-mail through Java.\n" +"Here is line 2.");
         //Send the message
         Transport.send(msg);
      }catch (MessagingException mex) {
        mex.printStackTrace();
    } Hope this might help :)
    REGARDS,
    RaHuL

  • Executing an (java)application remotely

    Hi,
    My problem is simple to describe. 192.168.0.1 is running a java app who wants to execute an entirely different java app on 192.168.0.2. The app should run on 0.2 rather than 0.1.
    Currently I use the ProcessBuilder to execute the different java app locally on 0.1. However I have no clue how to execute it via the network while making sure the app actually runs on the 0.2 machine. What I wish to know is how I can remotely execute an application (preferably via the the ProcessBuilder) and keep it running on that machine.
    Thank you
    Edited by: killingdjef on May 14, 2008 10:20 AM

    The same way you would run any other application remotely on that computer. It doesn't matter whether it's Java or not (although of course you do have to have a Java runtime installed there). How exactly would one run an application via the network using the Processbuilder? Again.. I have no problem starting a process locally but I can't seem to figure out how to run it via a network.
    One possibility would be to run a servlet (or a custom RMI server, or plain old socket server) on the remote machine that could spawn the application on that machine when contacted. Just be mindful of the security implications. This possibillity crossed my mind (and searches) but I was hoping there would be a more simpler solution. I'm not sure if you are familar with the processbuilder, forgive me if this is redundant, but the processbuilder allows execution of commands. What im trying to find is a command that allows remote execution of a java app. Maybe this is the inappropriate forum for my question?

Maybe you are looking for

  • Re: More control over html tags needed

    I have trying for a while to find an elegant solution to printing reports in such a way as to have headers and footers repeated on every printed page. <BR><BR><BR> The two main solutions seem to be either using PDF (using FOP) or controlling the size

  • Push one new app and Profile Manager resends them all; turn this off?

    I manage the ipads for a medium sized school district. We're using Apple Configurator on Maverics to manage about 700 ipads most of which have been updated to iOS7 and supervised manually through the mini that functions as our MDM and server. So aver

  • How to get PO attachments?

    Hi , My requirement is to get the attachments of PO and send them via email . I am looking for a FM which gets me the attachments in a PO (we can view attachments in PO display transaction ME23n. Select line item and click on button which has attachm

  • What is the best way for my small company to collect timesheets online?

    I have been using Acrobat 9 Pro. I have also tried acrobat.com and after reading the help file I tried to login to www.formscentral.com but can't. I have a simple form (pdf) that calculates the hours worked in a 2 week period. Most of our employees w

  • Screen saver issues

    Whenever i turn on my mac book pro the screen saver goes back to default, it never saves my desktop picture that i choose to have. How can i maintain the desktop picture without having to put it on every time i turn the power on my laptop?