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 3789432
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T12:09:21+00:00 2026-05-19T12:09:21+00:00

(This isn’t a homework question, as it’s above and beyond the class just for

  • 0

(This isn’t a homework question, as it’s above and beyond the class just for my personal interest.)

In my Java class this semester, our instructor is giving us the compiled JUnit tests that our completed labs should pass. For example, our first lab was to design this class:

package java112.labs1;

public class MysteryClassOne {

    public int mysteryMethodOne() {
        return 1;
    }
}

This is very trivial Java code and to give myself a bit more of a challenge as I’ve had previous Java experience, I’d like to do all of the assignments in JRuby, after completing them in Java. My only issue is all of the compiled tests are in the java112.labsX package and I can find no reference for how to assign a JRuby class to a Java package.

There you have it, in my typical long-winded fashion.

EDIT

Thanks to headius below for solving this issue. Here’s the code in JRuby if anyone’s interested:

require 'java'
java_package 'java112.labs1'

class MysteryClassOne
  java_signature 'int mysteryMethodOne()'
  def mysteryMethodOne
    return 1
  end
end
  • 1 1 Answer
  • 2 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-19T12:09:22+00:00Added an answer on May 19, 2026 at 12:09 pm

    Perhaps you’re interested in something like this:

    https://gist.github.com/789131

    This gist shows using JRuby’s “javac” compile mode to generate real Java classes. You can specify packages, interfaces to implement, signatures, and so on.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This isn't actually a homework question per se, just a question that keeps nagging
This isn't a homework question, by the way. It got brought up in class
This isn't exactly a programming question exactly. I just want to know what your
This isn't a question on proper coding practice, I'm just working through the semantics.
This isn't a complicated question. I was just thinking through best practice and thought
This isn't strictly a homework question, but an offshoot. How are time functions implemented
This isn't actually homework, I'm just looking through some questions in a discrete maths
This isn't the best question ever, but since search engines feel the need to
This isn't a question that I am expecting a specific answer to since it
This isn't strictly a programming question, but I'm asking it here because it's certainly

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.