Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 24 of 24

Thread: Problem with running the java application

  1. #1
    Junior Member
    Join Date
    Feb 2014
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Problem with running the java application

    Hi,

    I have a java application which uses Google Maps to analyze the traffic condition.
    But sometimes it can be run and work properly, sometimes not. On some computers on which there is installed java, the program can be run, and on some, again with installed java (jre), exactly the same version, the program can not be run. For example the application first run well on my desktop computer, connected in a LAN, and then stopped working well when run. But when I use laptop which uses the WiFi and run the same computer using VMWare, if I connect to the desktop on which the program can not be run, on the laptop the same program can be run well, in the same room, but using the Wifi.

    Can anybody tell me what could be the problem and how to solve it?
    Thanks.


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,067
    Thanks
    47
    Thanked 2,146 Times in 2,119 Posts

    Default Re: Problem with running the java application

    Are there any error messages that can help showing what the problem is?
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Feb 2014
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Problem with running the java application

    No, only the program doesn't open the window which is supposed to be a screen shot of the Google Map, but opens again the starting window for the program.

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,067
    Thanks
    47
    Thanked 2,146 Times in 2,119 Posts

    Default Re: Problem with running the java application

    It's hard to locate a problem without some error messages. Does the code have printStackTrace() calls in the catch blocks?
    If you don't understand my answer, don't ignore it, ask a question.

  5. #5
    Junior Member
    Join Date
    Feb 2014
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Problem with running the java application

    I put now, but again the same problem persists. Here is some of the code:

    try {
    			robot = new Robot();
     
    			ImageManipulation imageManipulation = new ImageManipulation();
     
    			mainWindow.setVisible(false);
     
    			if(GuiMain.USE_PARAMETERS) {
    				String htmlFilePath = "html" + ToolKit.fileSeparator() + "trafficPrototype.html";
    				File htmlFile = new File(htmlFilePath);
     
    				String[] params = {"coord=" + mapSection.getCoordString(), "view=2"};
    				ToolKit.openBrowser(htmlFile.toURI(), params);
    			} else {
    				String htmlFilePath = "html" + ToolKit.fileSeparator() + "trafficPrototype2.html";
    				File htmlFile = new File(htmlFilePath);
     
    				HtmlController.writeParameterScript(mapSection.getLat(), mapSection.getLng(), 
    					mapSection.getZoom(), 2, 0);//moe
    				ToolKit.openBrowser(htmlFile.toURI());
    			}
     
    			try {
    				Thread.sleep(15000);
    			} catch(InterruptedException ie) {
    				// ignore!
                    ie.printStackTrace();
                }
     
    			BufferedImage mapImageScreenshot = robot.createScreenCapture(
    				new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()));
     
    			mapImage = imageManipulation.retrieveMapImage(mapImageScreenshot);
     
    			try {
    				Thread.sleep(15000);
    			} catch(InterruptedException ie) {
     
                    ie.printStackTrace();
                }
    Last edited by Norm; June 18th, 2014 at 03:09 PM. Reason: QUOTE tags replaced with code tags

  6. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,067
    Thanks
    47
    Thanked 2,146 Times in 2,119 Posts

    Default Re: Problem with running the java application

    Without an error message, I can't guess what is wrong.

    Can you make a small, complete program that compiles, executes and shows the problem?
    If you don't understand my answer, don't ignore it, ask a question.

  7. #7
    Junior Member
    Join Date
    Feb 2014
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Problem with running the java application

    There isn't any message appearing. But if I run it on my laptop using VMware and WiFi, i.e. to run the same program connecting on the desktop computer where it doesn't work and doesn't show an error message, it will work as it should.
    How do you mean to make a small complete program tha compiles? This compiles and starts to work but when I chose the map that is supposed to open, it opens, but the window with the screen shot doesn't open, and no message appears as well.

  8. #8
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,067
    Thanks
    47
    Thanked 2,146 Times in 2,119 Posts

    Default Re: Problem with running the java application

    How do you mean to make a small complete program tha compiles?
    And executes and shows the problem for testing.

    If it requires VMware for testing that will be a problem.
    What do you mean by Wifi?
    If you don't understand my answer, don't ignore it, ask a question.

  9. #9
    Junior Member
    Join Date
    Feb 2014
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Problem with running the java application

    Wi-Fi= local area wireless technology

  10. #10
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,067
    Thanks
    47
    Thanked 2,146 Times in 2,119 Posts

    Default Re: Problem with running the java application

    Are you saying the desktop (where it fails) is wired to the network and the laptop (where it works) is using wifi to connect to the network?

    Why is VMware needed?
    If you don't understand my answer, don't ignore it, ask a question.

  11. #11
    Junior Member
    Join Date
    Feb 2014
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Problem with running the java application

    I use VMWare to connect to the desktop from my laptop. Yes, the desktop is connected in a cloud, connected on a LAN, and yes, the laptop uses the WiFi in the lab. But if I run the same program, copied on the local hard drive on the laptop it doesn't work as well if I use the internet at home. It works from home only if connected via VMware to the desktop in the lab

  12. #12
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,067
    Thanks
    47
    Thanked 2,146 Times in 2,119 Posts

    Default Re: Problem with running the java application

    The problem sounds like a configuration problem, not a java programming problem.
    If you don't understand my answer, don't ignore it, ask a question.

  13. #13
    Junior Member
    Join Date
    Feb 2014
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Problem with running the java application

    OK, so what do you suppose to do now? What could be wrong?
    And I forgot, in some parts of the day the program works on the desktop as well, but rarely. First it happened rarely, then frequent, and lately it doesn't work at all, although nothing has been changed meanwhile.

  14. #14
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,067
    Thanks
    47
    Thanked 2,146 Times in 2,119 Posts

    Default Re: Problem with running the java application

    I haven't worked with any of the components involved with your problem and have no idea what could be wrong.
    If you don't understand my answer, don't ignore it, ask a question.

  15. #15
    Junior Member
    Join Date
    Feb 2014
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Problem with running the java application

    I just meant if you can mention please what do you understand by configuration problem? In that context, can you please tell me several possible?

  16. #16
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,067
    Thanks
    47
    Thanked 2,146 Times in 2,119 Posts

    Default Re: Problem with running the java application

    How many different variables are there to the problem? One is the java program. What are the others?
    When and where does the java program work or not work? Is time of day a factor? Is load on the server a factor?
    If you don't understand my answer, don't ignore it, ask a question.

  17. #17
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    4,446
    My Mood
    Mellow
    Thanks
    144
    Thanked 607 Times in 594 Posts

    Default Re: Problem with running the java application

    How are you running the program? If you're running from a command shell, you should be seeing error messages when the program stops working. Or, run the program using a debugger or profiler to see where the problems might be.

  18. #18
    Junior Member
    Join Date
    Feb 2014
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Problem with running the java application

    I just run it from IntelliJ. I tried to debug it and again, the processing of the new window, which is supposed to be a screenshot of the map, finishes, and instead of the window with the screenshot of the map, the first, loading window, appears again. And no errors appear.

  19. #19
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    4,446
    My Mood
    Mellow
    Thanks
    144
    Thanked 607 Times in 594 Posts

    Default Re: Problem with running the java application

    Try running your program from the command line.

  20. #20
    Junior Member
    Join Date
    Feb 2014
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Problem with running the java application

    I also have another problem. I can't make a jar file, so how can I run the program from a command line? Can I?

  21. #21
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,067
    Thanks
    47
    Thanked 2,146 Times in 2,119 Posts

    Default Re: Problem with running the java application

    You don't need to put the class files in a jar file to execute them.

    Open a command prompt window,
    cd to the directory with the class file
    enter the command: java TheClassName

    If the class is in a package, you need to cd to the directory for the package name
    and enter the command: java thepackage.TheClassName
    If you don't understand my answer, don't ignore it, ask a question.

  22. #22
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    4,446
    My Mood
    Mellow
    Thanks
    144
    Thanked 607 Times in 594 Posts

    Default Re: Problem with running the java application

    Quote Originally Posted by nat View Post
    I also have another problem. I can't make a jar file, so how can I run the program from a command line? Can I?
    I don't mean to be rude or disrespectful, but the project you've described includes skills learned in chapters 9 and beyond of most Java books while running a Java program from the command line should be covered in chapter 2, maybe 3. You should really learn the Java basics - really learn them - before taking on advanced Java projects.

  23. #23
    Junior Member
    Join Date
    Feb 2014
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Problem with running the java application

    Thanks Greg

  24. #24
    Junior Member
    Join Date
    Feb 2014
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Problem with running the java application

    Thank you very much Norm. I tried this, but I made some mistake I suppose, so I will continue to try this. Thanks again

Similar Threads

  1. Re: Problem running web application with jboss
    By Programmingpeople in forum JDBC & Databases
    Replies: 1
    Last Post: October 17th, 2012, 09:07 AM
  2. Problem running web application with jboss
    By jessie in forum JDBC & Databases
    Replies: 0
    Last Post: July 29th, 2012, 12:04 PM
  3. MySQL Quit while java application is running
    By aueddonline in forum JDBC & Databases
    Replies: 6
    Last Post: February 6th, 2012, 01:55 PM
  4. Problem Running J2EE Application - JRE Version Error
    By rameshiit19 in forum Java IDEs
    Replies: 3
    Last Post: November 28th, 2011, 06:12 AM
  5. Shortcut executed or in-background running Java application
    By xixixao in forum Java Theory & Questions
    Replies: 2
    Last Post: April 22nd, 2011, 04:33 AM