Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7679053
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:47:16+00:00 2026-05-31T17:47:16+00:00

Okay, so I created a JavaScript file called test.js which contains the following code:

  • 0

Okay, so I created a JavaScript file called test.js which contains the following code:

print("It works!");

I compiled it using the Rhino JavaScript Compiler without any errors. Then I created a new file called foo.js which contains this code:

var test = require("./test.class");

Now when I run foo.js in Ringo in throws the following exception and stack trace:

Uncaught exception:
java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    at org.ringojs.tools.launcher.Main.run(Main.java:66)
    at org.ringojs.tools.launcher.Main.main(Main.java:45)
Caused by: java.lang.NoClassDefFoundError: /home/aaditmshah/test (wrong name: test)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
    at org.mozilla.javascript.DefiningClassLoader.defineClass(DefiningClassLoader.java:62)
    at org.ringojs.engine.ClassModuleLoader.load(ModuleLoader.java:126)
    at org.ringojs.engine.ReloadableScript.compileScript(ReloadableScript.java:153)
    at org.ringojs.engine.ReloadableScript.getScript(ReloadableScript.java:118)
    at org.ringojs.engine.ReloadableScript.exec(ReloadableScript.java:227)
    at org.ringojs.engine.ReloadableScript.load(ReloadableScript.java:215)
    at org.ringojs.engine.RingoWorker.loadModuleInternal(RingoWorker.java:283)
    at org.ringojs.engine.Require.call(Require.java:81)
    at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:97)
    at org.mozilla.javascript.gen._home_aaditmshah_foo_js_3._c_script_0(/home/aaditmshah/foo.js:1)
    at org.mozilla.javascript.gen._home_aaditmshah_foo_js_3.call(/home/aaditmshah/foo.js)
    at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:426)
    at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3178)
    at org.mozilla.javascript.gen._home_aaditmshah_foo_js_3.call(/home/aaditmshah/foo.js)
    at org.mozilla.javascript.gen._home_aaditmshah_foo_js_3.exec(/home/aaditmshah/foo.js)
    at org.ringojs.engine.ReloadableScript.evaluate(ReloadableScript.java:186)
    at org.ringojs.engine.RingoWorker.evaluateScript(RingoWorker.java:315)
    at org.ringojs.engine.RhinoEngine.runScript(RhinoEngine.java:186)
    at org.ringojs.tools.RingoRunner.run(RingoRunner.java:152)
    ... 6 more
enter code here

I don’t know where am I going wrong. I have the latest versions of Ringo and Rhino 1.7R3. I added the current directory to my classpath by prepending the following line to foo.js:

addToClasspath(module.resolve("."));

However, it still generates the same error. I have no idea how to make this work. Any help will be greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T17:47:17+00:00Added an answer on May 31, 2026 at 5:47 pm

    OK, I looked at the stack trace a little closer, and realized it’s finding the class file correctly, it just tries to load it from the wrong package (home.aaditmshah.test instead of just test). If the class file is in your module path, you can load it correctly with just the module (class) name. By default, the current directory isn’t in the module path, so you’ll have to add it first:

    require.paths.push('.')
    var test = require("test.class");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay, so I've got the following code shown below to create a dialog using
Okay, here is my problem... I created a Data Layer using the RTM Fluent
I need to code some complicated web page with new html5 features, using javascript
Okay I have a project that is using the android-rss library (org.mcsoxford.rss). I created
Okay, here's the situation: We have a table of about 50 columns (created by
Okay, mkstemp is the preferred way to create a temp file in POSIX. But
Okay, so I'm running a small test webserver on my private network. I've got
Okay, so I'm still learning here. Created a jsfiddle http://jsfiddle.net/JustJill54/GDVt6/ that will toggle visibility
If I have a page which contains an iframe: <iframe src=blank.html id=frame></iframe> and I
Okay, I created a listbox the items are bound to it, and for some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.