JR Frequently-Asked-Questions)

Source: Internet
Author: User
Here are some Frequently-Asked-Questions (with answers and some common mistakes people make when trying to run JR programs. some of this information applies specifically to UC Davis's CS department's CSIF systems, but it is also likely to apply to other systems.

  • Simple things:

    • "Jr Foo
      Jrvm exception: java. lang. ClassNotFoundException: Foo
      Java. lang. ClassNotFoundException: java. lang. ClassNotFoundException: Foo"
      You 've probably misspelled the name of your main class "Fooo ". suggestion: use "jrgo ". you don't specify the name of the main class to "jrgo"; instead, it will be able to figure that out (in most cases ).
    • "Main. jr: 6: unreported exception java. lang. interruptedException; must be caught or declared to be thrown ". thread. sleep (or some other method that can throw the above exception) needs to be in a try/catch block. see, e.g ., p11 of the JR book.
  • My JR program can't create all its processes!
    • I get errors like "jrvm exception: unable to create new native thread; java. lang. OutOfMemoryError: unable to create new native thread"
      • Be sure you're not trying to create too processing processes, e.g., via an infinite loop that sends to an op-method.
      • How many processes is "too tasks "? It depends on your system, but somewhere around und 200-300 shocould work on most systems. (You might find the program in vsuite/environment/maxproc/jr useful to get an idea of what your system supports .) however, an important detail: we 've seen systems configured such that they restrict the number of threads that can be created due to their limit on stacksize. in particle, on one such group of systems, under [t] csh, the stacksize limit was set to 256 M ("limit "), which interval tively limits the number of threads to about 12. A more reasonable setting is 8192 K ("limit stacksize 8192") or even 4096 K. and you might want to change the maxproc if it's too low; a more than reasonable setting is 1024 ("limit maxproc 1024 "). also, if you do change stacksize or maxproc, do so in your. cshrc so that the change also applies to multi-vm jr programs. note that we 've seen systems whose settings vary according to which shell you're using, so be careful with that. (Under bash, use "ulimit" instead of "limit" and place the commands in your. bashrc file .)
  • My JR program using Swing or AWT doesn't work!

    • My program seems just to terminate after it starts up. See discussion on p309 of the JR book. Add a "sleeper process" to your JR code or use "jr-explicit name_of_main_class ".
    • My program just hangs without opening up any windows on the screen. Be sure your constructors for the class that is creating the window terminates.
    • Make sure DISPLAY is set properly (see the instructions page ). if you're using VNC, you'll need to do something like "vncserver: 4" and then use "setenv DISPLAY: 4.0" in your. cshrc.
    • As a good, quick test: Make sure the specified program (in the codeextract) runs for you.
  • My multi-VM program doesn' t work!

    • I get errors that say something like "cannot create virtual machine on pc51......" or "cannot create virtual machine on localhost ...".

      • Be sure to check that the tests in Steps 4 and 5 on the instructions page work. even if you checked those previusly and your program used to work on this participating system, sometimes systems get upgraded, etc ., which can break the ssh setup.
      • Pay special attention that CLASSPATH and DISPLAY are exactly as specified on the instructions page.
      • Try your program on a different system (s). Again, sometime system problems or changes can break things.
      • Be sure your program isn't trying to create too into VMs. (How can you actually can create depends on system, etc ., but on csif I wouldn't try to create more than about 10 on a single host .) also, see notes on maximum number of processes.
    • My program isn't able to open files. non-main Jr VMS execute in the home directory rather than the current directory, which might make a difference if the JR program uses relative pathnames for files.
    • I'm getting
      "Edu. ucdavis. Jr. jrcommunicationexception: Java. RMI. financialexception:
      Error Checking alling arguments; Nested exception is: Java. Io. notserializableexception: Server
      ...".
      You'll need to make the server class "implements java. Io. serializable". See p152 and P305 In the JR text.
    • I'm getting a weird, uugly bunch of errors:
      "Java. Lang. nosuchmethodexception: mainframe. <init> (Java. Lang. String)
      At java. lang. Class. getConstructor0 (Class. java: 2647)
      At java. lang. Class. getConstructor (Class. java: 1629)
      At edu. ucdavis. jr. jrx. jrvm. innerCreateInstance (jrvm. java: 163)
      At sun. reflect. NativeMethodAccessorImpl. invoke0 (Native Method)
      At sun. reflect. NativeMethodAccessorImpl. invoke (NativeMethodAccessorImpl. java: 39)
      At sun. reflect. DelegatingMethodAccessorImpl. invoke (DelegatingMethodAccessorImpl. java: 25)
      At java. lang. reflect. Method. invoke (Method. java: 585)
      At sun. rmi. server. UnicastServerRef. dispatch (UnicastServerRef. java: 294)
      At sun. rmi. transport. Transport $ 1.run( Transport. java: 153)
      At java. security. AccessController. doPrivileged (Native Method)
      At sun. rmi. transport. Transport. serviceCall (Transport. java: 149)
      At sun. rmi. transport. tcp. TCPTransport. handleMessages (TCPTransport. java: 460)
      At sun. rmi. transport. tcp. TCPTransport $ ConnectionHandler. run (TCPTransport. java: 701)
      At java. lang. Thread. run (Thread. java: 595)
      Jrvm exception: java. rmi. ServerException: RemoteException occurred in server thread; nested exception is:
      Java. rmi. RemoteException: java. lang. NoSuchMethodException: MainFrame. <init> (java. lang. String)
      Edu. ucdavis. jr. jrCommunicationException: java. rmi. ServerException: RemoteException occurred in server thread; nested exception is:
      Java. rmi. RemoteException: java. lang. NoSuchMethodException: MainFrame. <init> (java. lang. String)
      At edu. ucdavis. jr. jrx. jrvm. createInstance (jrvm. java: 139)
      At Start. main (Start. java: 23)
      ...".
      You probably forgot to make your remote class constructors public.
  • Miscellany:

    • "Error: Unexpected end of file encountered while reading the class file". You 've probably exceeded your disk quota.
    • "Sh: Translator. out: Permission denied
      Expected 0, got 1 from jrc"
      When running jrv. you're trying to run jrv in a directory where you don't have write permissions. if you really want to run jrv, then copy the vsuite to someplace where you do have write permissions (and then use "jrv-d. "in that new directory ). do you need to run jrv? If you're using the already installed JR implementation in the CSIF, then no. if you 've installed your own version of JR on CSIF, then you shoshould run jrv, but first: why do you need your own JR when you can just use the already installed one? If you're running JR on your home machine, then running jrv is a good idea to check that it works.
    • "An exception has occurred in the jr translator... ". oops, looks like you found a bug. please send us your complete program (all. jr files) and we'll try to fix it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.