• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

NX: Cygwin?

 
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi folks,
For all those poor ranchers out there like me, who do not have access to a network, Cygwin is a free UNIX emulator that can potentially be used to test your projects before posting them to Sun. Has anyone out there tried this? I downloaded Cygwin and have been faffing about for hours trying to work out how to run my project, that is find the Unix equivalent of
java runme.jar
Not having used UNIX before, I am totally in the dark about the directory structure and set up. Does anyone know a UNIX greenhorn site that explains the basics? I don't fancy reading the entire Cygwin spec!
 
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Simon, the UNIX equivalent of "java runme.jar" is:
java runme.jar
If you download and install the JRE it's the same thing. Btw, why do you feel you need cygwin to test your app? If you write in your version.txt document what system you tested it on, the grader will use that system to test it (I am assuming).
 
Simon Ingram
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Min Huang,
I have heard that the tester will use any machine he wants to. Rumours suggest there is a preference for SOLARIS. The idea is that our submission will work on any platform! This is why books covering the Exam suggest testing on different platforms, which is fine if you have access to them and why I considered the poor man's version, namely using Cygwin!
It is one thing to have the idea, but another to implement it! I guessed too that
java -jar runme.jar
would work at the Cygwin command line, but I am not sure about the set up or the directory structure. UNIX is a different world! I have spent several hours looking at the UNIX for beginners site and apart from a lot of moaning about how lousy DOS and Microsoft are, I still don't know how to navigate around a unix file system! Still, I will keep at it. Problem is that I don't want to learn UNIX, I just want to test my application! If you know any shortcuts or helpful web sites I would be grateful.
regards
Simon
 
Min Huang
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Simon,
I wouldn't worry about what platform the grader uses to run your app. It's supposed to run the same on all the JVM's so if that's not the case, blame the JVM But one thing you have to watch out for is to use a system independent look and feel so your GUI won't look different from one system to the next.
If you are really dead set about using Cygwin, download the setup and install everything in the devel package so you are set up with java and javac (err.. at least I think it's the devel package.. you'll know if you've got it if you type "which java" and a path appears). Then just move your runme.jar file into your /home/<username> directory (relative to where u installed cygwin), run cygwin and type "ls" to make sure your jar is there. Then type "java -jar runme.jar" and your app launches.
Or if your local libraries have the JRE installed u can set up your server from home and test your app from the library hehe.
[ April 20, 2004: Message edited by: Min Huang ]
[ April 20, 2004: Message edited by: Min Huang ]
 
Ranch Hand
Posts: 319
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


But one thing you have to watch out for is to use a system independent look and feel so your GUI won't look different from one system to the next.


Min, why do you think this is necessary?
The whole point of the "System" L&F is so that your app looks like a native app on any platform.
That is what I used and it was perfectly fine.
J
 
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Umm I won't be supprised if they test your assignments on different platforms to iron out problems with code that is platform dependent. eg, threading has a lot of those... hmm maybe that is why ppl score 44/80...? If I were you I would test it on Linux as well Better safe than sorry.
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Simon,
I do not believe that running Cygwin will gain you anything. You are still running the version of Java designed for MS Windows, and any coding that you have done which is MS Windows specific will continue to run perfectly when run under Cygwin, because you are still running the MS Windows version of Java.
Probably the reason you cannot run Java from within Cygwin is because the java executable is not called java in MS Windows - it is called java.exe - Microsoft insists that the executable have a magic cookie at the start which identifies it as an executable, but then proceeds to totally ignore it :roll: if the file extension is not ".exe". So to run the MS Windows Java executable under Cygwin you have to type java.exe.
I just installed a clean machine, and installed cygwin and JDK 1.4 on it. I was able to get java to run instantly from within the cygwin command window (bash), as the JDK installed a copy of java.exe in the c:\windows directory, which cygwin puts into the path by default.
To get the java compiler to work under cygwin I had to set up a couple of environmental variables:

Then I was able to run the compiler as well.
I then created this simple program to see what would happen:

This program compiled and ran perfectly under Cygwin, however as expected, the reported file separator was "\" (the MS Windows file separator), and the program found and read the file which was hard coded to an MS Windows directory.
I think you cannot install the Linux JDK into Cygwin (but I am not sure - you could try, I guess).
Regarding the look and feel - I would actually recommend forcing the Java look and feel rather than going with the system default. Using the system defaults could mean that your perfect looking screen on one OS may look completely different (and appear unusable) on a different OS.
Regards, Andrew
[ April 21, 2004: Message edited by: Andrew Monkhouse ]
 
Min Huang
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Min, why do you think this is necessary?
The whole point of the "System" L&F is so that your app looks like a native app on any platform.
That is what I used and it was perfectly fine.


That's the problem. With your system's lnf your app might look wonderful, but in somebody else's lnf it might look really weird. With a Java lnf you can be sure your app looks the same on any platform. I used native lnf at first, and I was on a WinXP machine. My app was loaded on a Mac and it just looked ghastly.
Of course, if you take into account in your gui code that your widgets might be displayed different only different platforms, certainly choosing the native lnf would give richer user experience. I decided not to bother with it and just go the easy route.

Umm I won't be supprised if they test your assignments on different platforms to iron out problems with code that is platform dependent. eg, threading has a lot of those... hmm maybe that is why ppl score 44/80...? If I were you I would test it on Linux as well Better safe than sorry.


If you are writing threading code that depends on a platform dependent thread scheduler it's a better idea to first go read a Threads tutorial than test Plus, as Andrew says, testing on Cygwin isn't going to help you in that respect.

I think you cannot install the Linux JDK into Cygwin (but I am not sure - you could try, I guess).


It's true. You can't install it.
 
Anna Hays
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


If you are writing threading code that depends on a platform dependent thread scheduler it's a better idea to first go read a Threads tutorial than test Plus, as Andrew says, testing on Cygwin isn't going to help you in that respect.


I didn't use any platform/JVM dependent threading, but Sun doesn't know that. Also, testing is always good There are plenty more reasons that Sun will test under other platforms I would expect... I am a perfectionist.
 
Ranch Hand
Posts: 293
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is a related thread about portability tips if you are unable to test on UNIX. I was not able to test on UNIX, so I started that thread to get tips on things to watch out for. .Portability thread
That thread mentions something about an ArrayOutOfBoundsIndexException, but I never saw this in Windows XP and never looked into it.
I did make sure to use the correct path separator.
And I used system look and feel for GUI:
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
I stressed a little at first when I realized that it was not going to be possible for me to test on UNIX. I think that thread I linked to above has a comment in it about how you miss the fun if you don't test in all environments. Unfortunately, testing everywhere wasn't possible so I just tried to take all the precautions I could.
Good luck!
TJ
reply
    Bookmark Topic Watch Topic
  • New Topic