This week's book giveaway is in the Artificial Intelligence and Machine Learning forum.
We're giving away four copies of Machine Learning with R: Expert techniques for predictive modeling and have Brett Lantz on-line!
See this thread for details.
Win a copy of Machine Learning with R: Expert techniques for predictive modeling this week in the Artificial Intelligence and Machine Learning forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

ACM.jar with OS X Yosemite. help needed!

 
Greenhorn
Posts: 9
Mac Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all.

I'm starting out learning java for my university course and have been doing fine using "the art and science of java" textbook and the acm.jar package under linux. However, i've recently switched back to OS X 10.10 and I'm getting the following error message whenever i try running anything that imports ACM. I'd include the source code but this is happening with literally any ACM based program.

Exception in thread "main" acm.util.ErrorException: Cannot determine the main class.
at acm.program.Program.main(Program.java:1358)


line 1358 contains the following hex values (i know it doesn't mean much out of context but i'm out of ideas):

5549 d985 e89a 53cc ab25 4ee7 42cf 045a

Any ideas about how to get around this issue so i can resume learning would be greatly appreciated and if anyone wants any more information about this issue just let me know!

Thanks!
 
Marshal
Posts: 65821
250
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

That exception sounds as though you have got the .jar installed correctly, but there is something wrong with the class you are trying to execute. The line numbers refer to the .java file, not the hex file with the bytecode in.
What instruction are you using to run that code? Is the .jar intended to be a resource for your programs to use or is it actually executable?
 
Ryan Needham
Greenhorn
Posts: 9
Mac Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Welcome to the Ranch

That exception sounds as though you have got the .jar installed correctly, but there is something wrong with the class you are trying to execute. The line numbers refer to the .java file, not the hex file with the bytecode in.
What instruction are you using to run that code? Is the .jar intended to be a resource for your programs to use or is it actually executable?



thanks!

the best way i can think is to use an example. So heres how its dealing with a hello world program, "hello.java":

import acm.program.*;



- the program compiles with "javac hello.java" with no errors or warnings.

- when running "java hello" i get the above error.

- this exact program and these exact commands worked perfectly on linux but have yet to work on anything running OS X

 
Campbell Ritchie
Marshal
Posts: 65821
250
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where do you get the ACM .jar from? I might download it and try it out.
 
Campbell Ritchie
Marshal
Posts: 65821
250
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, since I am not running OS X I am not sure it will help if I run the code. Are you compiling it on OS X? What version of Java® are you using?

Anybody else know anything about OS X? I don't.
 
Ryan Needham
Greenhorn
Posts: 9
Mac Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Where do you get the ACM .jar from? I might download it and try it out.



http://cs.stanford.edu/people/eroberts/jtf/

If you scroll down to the downloads section acm.jar is in that list.
 
Ryan Needham
Greenhorn
Posts: 9
Mac Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Actually, since I am not running OS X I am not sure it will help if I run the code. Are you compiling it on OS X? What version of Java® are you using?

Anybody else know anything about OS X? I don't.



compiling on OS X yeah.

java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
 
Campbell Ritchie
Marshal
Posts: 65821
250
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you running that program at a terminal? What happens when you pass the following two instructions:-

java -version
javac -version

[edit]I see you have already answered one of my questions.

Anybody else?[/edit]
 
Ryan Needham
Greenhorn
Posts: 9
Mac Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Are you running that program at a terminal? What happens when you lass the following two instructions:-

java -version
javac -version

[edit]I see you have already answered one of my questions.

Anybody else?[/edit]



javac -version = javac 1.8.0_45
 
Marshal
Posts: 7185
492
Mac OS X VI Editor BSD Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ryan,

Try to extend "Program" not "ConsoleProgram" see what happens.
 
Ryan Needham
Greenhorn
Posts: 9
Mac Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Liutauras Vilda wrote:Ryan,

Try to extend "Program" not "ConsoleProgram" see what happens.





im afraid this has no effect. :/
 
Liutauras Vilda
Marshal
Posts: 7185
492
Mac OS X VI Editor BSD Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It should give you results in console, rather than graphical environment.
How do you compile your program and where do you execute?
 
Ryan Needham
Greenhorn
Posts: 9
Mac Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Liutauras Vilda wrote:It should give you results in console, rather than graphical environment.
How do you compile your program and where do you execute?



The issue is that the program will not run at all, in either graphical or console. changing the "ConsoleProgram" to "Program" just behaved exactly the same.

i am compiling my programs in a terminal with "javac fileName.java" which produces no error messages and behaves as normal (from what i can tell)

execution is done in the same terminal window with "java fileName"
 
Campbell Ritchie
Marshal
Posts: 65821
250
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried that same program as you had and got exactly the same Exception. Although Program (which you are extending) has a main method, it requires you have a main method in your cirrent class. Look at the associated tutorial, page 4.

I enhanced your class to print out methods and interfaces.It shows that you get the Hello World output, then no interfaces (I had thought it implemented Runnable but apparently not). Then
******
Then you get its inheritance hierarchy; that is peculiar having a console application which extends applet.
Then *******
and names of all methods. You notice that even though Program has a main method, the only main method appearing in that printout is in Hello.
 
Liutauras Vilda
Marshal
Posts: 7185
492
Mac OS X VI Editor BSD Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Still not clear why:

Ryan Needham wrote:- this exact program and these exact commands worked perfectly on linux but have yet to work on anything running OS X

 
Campbell Ritchie
Marshal
Posts: 65821
250
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you try thisyou get this output:-

javac -cp .:acm.jar Hello.java
java -cp .:acm.jar Hello
java -cp .:acm.jar Hellopublic void acm.program.ConsoleProgram.setFont(java.lang.String)
public void acm.program.ConsoleProgram.setFont(java.awt.Font)
public void acm.program.ConsoleProgram.run()
public void acm.program.ConsoleProgram.init()
public void acm.program.Program.validate()
public final boolean acm.program.Program.readBoolean(java.lang.String)
public boolean acm.program.Program.readBoolean(java.lang.String,java.lang.String,java.lang.String)
public final boolean acm.program.Program.readBoolean()
public final double acm.program.Program.readDouble()
public double acm.program.Program.readDouble(java.lang.String,double,double)
public final double acm.program.Program.readDouble(java.lang.String)
public final double acm.program.Program.readDouble(double,double)
public acm.io.IOConsole acm.program.Program.getConsole()
public void acm.program.Program.showErrorMessage(java.lang.String)
public boolean acm.program.Program.isAppletMode()
public void acm.program.Program.setConsole(acm.io.IOConsole)
public void acm.program.Program.setDialog(acm.io.IODialog)
public acm.io.IODialog acm.program.Program.getDialog()
public void acm.program.Program.setInputModel(acm.io.IOModel)
public void acm.program.Program.setOutputModel(acm.io.IOModel)
public acm.io.IOModel acm.program.Program.getInputModel()
public acm.io.IOModel acm.program.Program.getOutputModel()
public java.io.BufferedReader acm.program.Program.getReader()
public java.io.PrintWriter acm.program.Program.getWriter()
public javax.swing.JPanel acm.program.Program.getRegionPanel(java.lang.String)
public void acm.program.Program.addActionListeners(java.awt.event.ActionListener)
public void acm.program.Program.addActionListeners()
public void acm.program.Program.setTitle(java.lang.String)
public java.lang.String acm.program.Program.getTitle()
public acm.program.ProgramMenuBar acm.program.Program.getMenuBar()
public void acm.program.Program.addExitHook(java.lang.Object)
public void acm.program.Program.setParameter(java.lang.String,java.lang.String)
public java.lang.Thread acm.program.Program.getMainThread()
public void acm.program.Program.pause(double)
public java.awt.Dimension acm.program.Program.getCentralRegionSize()
public void acm.program.Program.mouseClicked(java.awt.event.MouseEvent)
public void acm.program.Program.mousePressed(java.awt.event.MouseEvent)
public void acm.program.Program.mouseReleased(java.awt.event.MouseEvent)
public void acm.program.Program.mouseEntered(java.awt.event.MouseEvent)
public void acm.program.Program.mouseExited(java.awt.event.MouseEvent)
public void acm.program.Program.mouseMoved(java.awt.event.MouseEvent)
public void acm.program.Program.mouseDragged(java.awt.event.MouseEvent)
public void acm.program.Program.keyTyped(java.awt.event.KeyEvent)
public void acm.program.Program.keyPressed(java.awt.event.KeyEvent)
public void acm.program.Program.keyReleased(java.awt.event.KeyEvent)
public void acm.program.Program.actionPerformed(java.awt.event.ActionEvent)
public java.awt.Dimension acm.program.Program.getPreferredSize()
public int acm.program.Program.getWidth()
public int acm.program.Program.getHeight()
public java.lang.String acm.program.Program.getParameter(java.lang.String)
public void acm.program.Program.setLayout(java.awt.LayoutManager)
public java.awt.LayoutManager acm.program.Program.getLayout()
public void acm.program.Program.setBackground(java.awt.Color)
public void acm.program.Program.repaint()
public boolean acm.program.Program.menuAction(java.awt.event.ActionEvent)
public final void acm.program.Program.println(double)
public final void acm.program.Program.println(int)
public final void acm.program.Program.println(long)
public final void acm.program.Program.println(java.lang.Object)
public void acm.program.Program.println()
public void acm.program.Program.println(java.lang.String)
public final void acm.program.Program.println(boolean)
public final void acm.program.Program.println(char)
public final void acm.program.Program.println(float)
public static void acm.program.Program.main(java.lang.String[])
public void acm.program.Program.exit()
public void acm.program.Program.add(java.awt.Component,java.lang.String,java.lang.Object)
public void acm.program.Program.remove(java.awt.Component)
public void acm.program.Program.remove(int)
public void acm.program.Program.start(java.lang.String[])
public final void acm.program.Program.start()
public void acm.program.Program.destroy()
public final void acm.program.Program.print(double)
public final void acm.program.Program.print(long)
public final void acm.program.Program.print(float)
public void acm.program.Program.print(java.lang.String)
public final void acm.program.Program.print(char)
public final void acm.program.Program.print(boolean)
public final void acm.program.Program.print(int)
public final void acm.program.Program.print(java.lang.Object)
public final java.lang.String acm.program.Program.readLine()
public java.lang.String acm.program.Program.readLine(java.lang.String)
public final int acm.program.Program.readInt(java.lang.String)
public final int acm.program.Program.readInt(int,int)
public final int acm.program.Program.readInt()
public int acm.program.Program.readInt(java.lang.String,int,int)
public void acm.program.Program.removeAll()
public void javax.swing.JApplet.setTransferHandler(javax.swing.TransferHandler)
public javax.swing.TransferHandler javax.swing.JApplet.getTransferHandler()
public void javax.swing.JApplet.setJMenuBar(javax.swing.JMenuBar)
public javax.swing.JMenuBar javax.swing.JApplet.getJMenuBar()
public void javax.swing.JApplet.setContentPane(java.awt.Container)
public javax.swing.JLayeredPane javax.swing.JApplet.getLayeredPane()
public void javax.swing.JApplet.setLayeredPane(javax.swing.JLayeredPane)
public java.awt.Component javax.swing.JApplet.getGlassPane()
public void javax.swing.JApplet.setGlassPane(java.awt.Component)
public javax.accessibility.AccessibleContext javax.swing.JApplet.getAccessibleContext()
public void javax.swing.JApplet.repaint(long,int,int,int,int)
public java.awt.Container javax.swing.JApplet.getContentPane()
public java.awt.Graphics javax.swing.JApplet.getGraphics()
public javax.swing.JRootPane javax.swing.JApplet.getRootPane()
public void javax.swing.JApplet.update(java.awt.Graphics)
public boolean java.applet.Applet.isActive()
public java.net.URL java.applet.Applet.getDocumentBase()
public java.applet.AppletContext java.applet.Applet.getAppletContext()
public boolean java.applet.Applet.isValidateRoot()
public void java.applet.Applet.showStatus(java.lang.String)
public java.awt.Image java.applet.Applet.getImage(java.net.URL,java.lang.String)
public java.awt.Image java.applet.Applet.getImage(java.net.URL)
public static final java.applet.AudioClip java.applet.Applet.newAudioClip(java.net.URL)
public java.applet.AudioClip java.applet.Applet.getAudioClip(java.net.URL,java.lang.String)
public java.applet.AudioClip java.applet.Applet.getAudioClip(java.net.URL)
public java.lang.String java.applet.Applet.getAppletInfo()
public java.util.Locale java.applet.Applet.getLocale()
public java.lang.String[][] java.applet.Applet.getParameterInfo()
public void java.applet.Applet.play(java.net.URL)
public void java.applet.Applet.play(java.net.URL,java.lang.String)
public final void java.applet.Applet.setStub(java.applet.AppletStub)
public void java.applet.Applet.stop()
public java.net.URL java.applet.Applet.getCodeBase()
public void java.applet.Applet.resize(java.awt.Dimension)
public void java.applet.Applet.resize(int,int)
public void java.awt.Panel.addNotify()
public final void java.awt.Container.setFocusTraversalPolicyProvider(boolean)
public void java.awt.Container.paint(java.awt.Graphics)
public int java.awt.Container.countComponents()
public java.awt.Component[] java.awt.Container.getComponents()
public java.awt.Insets java.awt.Container.insets()
public void java.awt.Container.setComponentZOrder(java.awt.Component,int)
public int java.awt.Container.getComponentZOrder(java.awt.Component)
public void java.awt.Container.doLayout()
public void java.awt.Container.layout()
public void java.awt.Container.invalidate()
public java.awt.Dimension java.awt.Container.preferredSize()
public java.awt.Dimension java.awt.Container.getMinimumSize()
public java.awt.Dimension java.awt.Container.minimumSize()
public java.awt.Dimension java.awt.Container.getMaximumSize()
public float java.awt.Container.getAlignmentX()
public float java.awt.Container.getAlignmentY()
public void java.awt.Container.paintComponents(java.awt.Graphics)
public void java.awt.Container.printComponents(java.awt.Graphics)
public synchronized void java.awt.Container.addContainerListener(java.awt.event.ContainerListener)
public synchronized void java.awt.Container.removeContainerListener(java.awt.event.ContainerListener)
public synchronized java.awt.event.ContainerListener[] java.awt.Container.getContainerListeners()
public java.util.EventListener[] java.awt.Container.getListeners(java.lang.Class)
public void java.awt.Container.deliverEvent(java.awt.Event)
public java.awt.Component java.awt.Container.getComponentAt(int,int)
public java.awt.Component java.awt.Container.getComponentAt(java.awt.Point)
public java.awt.Component java.awt.Container.locate(int,int)
public java.awt.Point java.awt.Container.getMousePosition(boolean) throws java.awt.HeadlessException
public java.awt.Component java.awt.Container.findComponentAt(int,int)
public java.awt.Component java.awt.Container.findComponentAt(java.awt.Point)
public void java.awt.Container.removeNotify()
public boolean java.awt.Container.isAncestorOf(java.awt.Component)
public void java.awt.Container.setFocusTraversalKeys(int,java.util.Set)
public java.util.Set java.awt.Container.getFocusTraversalKeys(int)
public boolean java.awt.Container.areFocusTraversalKeysSet(int)
public boolean java.awt.Container.isFocusCycleRoot(java.awt.Container)
public boolean java.awt.Container.isFocusCycleRoot()
public void java.awt.Container.setFocusTraversalPolicy(java.awt.FocusTraversalPolicy)
public java.awt.FocusTraversalPolicy java.awt.Container.getFocusTraversalPolicy()
public boolean java.awt.Container.isFocusTraversalPolicySet()
public void java.awt.Container.setFocusCycleRoot(boolean)
public final boolean java.awt.Container.isFocusTraversalPolicyProvider()
public void java.awt.Container.transferFocusDownCycle()
public void java.awt.Container.applyComponentOrientation(java.awt.ComponentOrientation)
public void java.awt.Container.addPropertyChangeListener(java.beans.PropertyChangeListener)
public void java.awt.Container.addPropertyChangeListener(java.lang.String,java.beans.PropertyChangeListener)
public int java.awt.Container.getComponentCount()
public java.awt.Insets java.awt.Container.getInsets()
public java.awt.Component java.awt.Container.getComponent(int)
public java.awt.Component java.awt.Container.add(java.awt.Component)
public void java.awt.Container.add(java.awt.Component,java.lang.Object,int)
public java.awt.Component java.awt.Container.add(java.lang.String,java.awt.Component)
public java.awt.Component java.awt.Container.add(java.awt.Component,int)
public void java.awt.Container.add(java.awt.Component,java.lang.Object)
public void java.awt.Container.list(java.io.PrintStream,int)
public void java.awt.Container.list(java.io.PrintWriter,int)
public void java.awt.Container.print(java.awt.Graphics)
public void java.awt.Component.setForeground(java.awt.Color)
public void java.awt.Component.firePropertyChange(java.lang.String,double,double)
public void java.awt.Component.firePropertyChange(java.lang.String,byte,byte)
public void java.awt.Component.firePropertyChange(java.lang.String,char,char)
public void java.awt.Component.firePropertyChange(java.lang.String,long,long)
public void java.awt.Component.firePropertyChange(java.lang.String,float,float)
public void java.awt.Component.firePropertyChange(java.lang.String,short,short)
public final java.lang.Object java.awt.Component.getTreeLock()
public java.awt.Point java.awt.Component.getMousePosition() throws java.awt.HeadlessException
public java.awt.GraphicsConfiguration java.awt.Component.getGraphicsConfiguration()
public final void java.awt.Component.dispatchEvent(java.awt.AWTEvent)
public boolean java.awt.Component.isVisible()
public boolean java.awt.Component.isEnabled()
public boolean java.awt.Component.isDisplayable()
public boolean java.awt.Component.isFocusable()
public boolean java.awt.Component.isLightweight()
public java.awt.peer.ComponentPeer java.awt.Component.getPeer()
public boolean java.awt.Component.isFocusOwner()
public void java.awt.Component.transferFocus()
public boolean java.awt.Component.isPreferredSizeSet()
public boolean java.awt.Component.isMinimumSizeSet()
public boolean java.awt.Component.isMaximumSizeSet()
public boolean java.awt.Component.handleEvent(java.awt.Event)
public boolean java.awt.Component.postEvent(java.awt.Event)
public void java.awt.Component.transferFocusBackward()
public java.awt.Container java.awt.Component.getFocusCycleRootAncestor()
public void java.awt.Component.requestFocus()
public int java.awt.Component.getX()
public int java.awt.Component.getY()
public synchronized void java.awt.Component.setDropTarget(java.awt.dnd.DropTarget)
public synchronized java.awt.dnd.DropTarget java.awt.Component.getDropTarget()
public void java.awt.Component.setEnabled(boolean)
public boolean java.awt.Component.isDoubleBuffered()
public void java.awt.Component.enableInputMethods(boolean)
public void java.awt.Component.show()
public void java.awt.Component.show(boolean)
public void java.awt.Component.hide()
public java.awt.Color java.awt.Component.getForeground()
public boolean java.awt.Component.isForegroundSet()
public java.awt.Color java.awt.Component.getBackground()
public boolean java.awt.Component.isBackgroundSet()
public boolean java.awt.Component.isFontSet()
public java.awt.image.ColorModel java.awt.Component.getColorModel()
public java.awt.Point java.awt.Component.getLocationOnScreen()
public void java.awt.Component.setLocation(java.awt.Point)
public void java.awt.Component.setLocation(int,int)
public void java.awt.Component.move(int,int)
public java.awt.Rectangle java.awt.Component.getBounds(java.awt.Rectangle)
public java.awt.Rectangle java.awt.Component.getBounds()
public java.awt.Rectangle java.awt.Component.bounds()
public void java.awt.Component.reshape(int,int,int,int)
public void java.awt.Component.setPreferredSize(java.awt.Dimension)
public void java.awt.Component.setMinimumSize(java.awt.Dimension)
public void java.awt.Component.setMaximumSize(java.awt.Dimension)
public int java.awt.Component.getBaseline(int,int)
public java.awt.Component$BaselineResizeBehavior java.awt.Component.getBaselineResizeBehavior()
public void java.awt.Component.revalidate()
public java.awt.FontMetrics java.awt.Component.getFontMetrics(java.awt.Font)
public java.awt.Cursor java.awt.Component.getCursor()
public boolean java.awt.Component.isCursorSet()
public void java.awt.Component.paintAll(java.awt.Graphics)
public boolean java.awt.Component.imageUpdate(java.awt.Image,int,int,int,int,int)
public java.awt.Image java.awt.Component.createImage(java.awt.image.ImageProducer)
public java.awt.Image java.awt.Component.createImage(int,int)
public java.awt.image.VolatileImage java.awt.Component.createVolatileImage(int,int)
public java.awt.image.VolatileImage java.awt.Component.createVolatileImage(int,int,java.awt.ImageCapabilities) throws java.awt.AWTException
public boolean java.awt.Component.prepareImage(java.awt.Image,int,int,java.awt.image.ImageObserver)
public boolean java.awt.Component.prepareImage(java.awt.Image,java.awt.image.ImageObserver)
public int java.awt.Component.checkImage(java.awt.Image,int,int,java.awt.image.ImageObserver)
public int java.awt.Component.checkImage(java.awt.Image,java.awt.image.ImageObserver)
public void java.awt.Component.setIgnoreRepaint(boolean)
public boolean java.awt.Component.getIgnoreRepaint()
public boolean java.awt.Component.inside(int,int)
public synchronized void java.awt.Component.removeComponentListener(java.awt.event.ComponentListener)
public synchronized java.awt.event.ComponentListener[] java.awt.Component.getComponentListeners()
public synchronized void java.awt.Component.addFocusListener(java.awt.event.FocusListener)
public synchronized void java.awt.Component.removeFocusListener(java.awt.event.FocusListener)
public synchronized java.awt.event.FocusListener[] java.awt.Component.getFocusListeners()
public void java.awt.Component.addHierarchyListener(java.awt.event.HierarchyListener)
public void java.awt.Component.removeHierarchyListener(java.awt.event.HierarchyListener)
public synchronized java.awt.event.HierarchyListener[] java.awt.Component.getHierarchyListeners()
public void java.awt.Component.addHierarchyBoundsListener(java.awt.event.HierarchyBoundsListener)
public void java.awt.Component.removeHierarchyBoundsListener(java.awt.event.HierarchyBoundsListener)
public synchronized java.awt.event.HierarchyBoundsListener[] java.awt.Component.getHierarchyBoundsListeners()
public synchronized void java.awt.Component.addKeyListener(java.awt.event.KeyListener)
public synchronized void java.awt.Component.removeKeyListener(java.awt.event.KeyListener)
public synchronized java.awt.event.KeyListener[] java.awt.Component.getKeyListeners()
public synchronized void java.awt.Component.addMouseListener(java.awt.event.MouseListener)
public synchronized void java.awt.Component.removeMouseListener(java.awt.event.MouseListener)
public synchronized java.awt.event.MouseListener[] java.awt.Component.getMouseListeners()
public synchronized void java.awt.Component.addMouseMotionListener(java.awt.event.MouseMotionListener)
public synchronized void java.awt.Component.removeMouseMotionListener(java.awt.event.MouseMotionListener)
public synchronized java.awt.event.MouseMotionListener[] java.awt.Component.getMouseMotionListeners()
public synchronized void java.awt.Component.addMouseWheelListener(java.awt.event.MouseWheelListener)
public synchronized void java.awt.Component.removeMouseWheelListener(java.awt.event.MouseWheelListener)
public synchronized java.awt.event.MouseWheelListener[] java.awt.Component.getMouseWheelListeners()
public synchronized void java.awt.Component.addInputMethodListener(java.awt.event.InputMethodListener)
public synchronized void java.awt.Component.removeInputMethodListener(java.awt.event.InputMethodListener)
public synchronized java.awt.event.InputMethodListener[] java.awt.Component.getInputMethodListeners()
public java.awt.im.InputMethodRequests java.awt.Component.getInputMethodRequests()
public java.awt.im.InputContext java.awt.Component.getInputContext()
public boolean java.awt.Component.mouseDown(java.awt.Event,int,int)
public boolean java.awt.Component.mouseDrag(java.awt.Event,int,int)
public boolean java.awt.Component.mouseUp(java.awt.Event,int,int)
public boolean java.awt.Component.mouseMove(java.awt.Event,int,int)
public boolean java.awt.Component.mouseEnter(java.awt.Event,int,int)
public boolean java.awt.Component.mouseExit(java.awt.Event,int,int)
public boolean java.awt.Component.keyDown(java.awt.Event,int)
public boolean java.awt.Component.keyUp(java.awt.Event,int)
public boolean java.awt.Component.action(java.awt.Event,java.lang.Object)
public boolean java.awt.Component.gotFocus(java.awt.Event,java.lang.Object)
public boolean java.awt.Component.lostFocus(java.awt.Event,java.lang.Object)
public boolean java.awt.Component.isFocusTraversable()
public void java.awt.Component.setFocusable(boolean)
public void java.awt.Component.setFocusTraversalKeysEnabled(boolean)
public boolean java.awt.Component.getFocusTraversalKeysEnabled()
public boolean java.awt.Component.requestFocusInWindow()
public void java.awt.Component.nextFocus()
public void java.awt.Component.transferFocusUpCycle()
public boolean java.awt.Component.hasFocus()
public void java.awt.Component.removePropertyChangeListener(java.lang.String,java.beans.PropertyChangeListener)
public void java.awt.Component.removePropertyChangeListener(java.beans.PropertyChangeListener)
public java.beans.PropertyChangeListener[] java.awt.Component.getPropertyChangeListeners(java.lang.String)
public java.beans.PropertyChangeListener[] java.awt.Component.getPropertyChangeListeners()
public void java.awt.Component.setComponentOrientation(java.awt.ComponentOrientation)
public java.awt.ComponentOrientation java.awt.Component.getComponentOrientation()
public void java.awt.Component.setLocale(java.util.Locale)
public boolean java.awt.Component.isValid()
public java.awt.Font java.awt.Component.getFont()
public void java.awt.Component.repaint(int,int,int,int)
public void java.awt.Component.repaint(long)
public void java.awt.Component.setVisible(boolean)
public java.awt.Toolkit java.awt.Component.getToolkit()
public void java.awt.Component.printAll(java.awt.Graphics)
public boolean java.awt.Component.isShowing()
public synchronized void java.awt.Component.addComponentListener(java.awt.event.ComponentListener)
public void java.awt.Component.setCursor(java.awt.Cursor)
public void java.awt.Component.setBounds(int,int,int,int)
public void java.awt.Component.setBounds(java.awt.Rectangle)
public void java.awt.Component.add(java.awt.PopupMenu)
public void java.awt.Component.remove(java.awt.MenuComponent)
public java.lang.String java.awt.Component.toString()
public java.lang.String java.awt.Component.getName()
public boolean java.awt.Component.contains(int,int)
public boolean java.awt.Component.contains(java.awt.Point)
public java.awt.Dimension java.awt.Component.size()
public java.awt.Container java.awt.Component.getParent()
public java.awt.Point java.awt.Component.getLocation(java.awt.Point)
public java.awt.Point java.awt.Component.getLocation()
public void java.awt.Component.setName(java.lang.String)
public void java.awt.Component.list(java.io.PrintWriter)
public void java.awt.Component.list(java.io.PrintStream)
public void java.awt.Component.list()
public java.awt.Dimension java.awt.Component.getSize(java.awt.Dimension)
public java.awt.Dimension java.awt.Component.getSize()
public boolean java.awt.Component.isOpaque()
public java.awt.Point java.awt.Component.location()
public void java.awt.Component.setSize(java.awt.Dimension)
public void java.awt.Component.setSize(int,int)
public void java.awt.Component.enable()
public void java.awt.Component.enable(boolean)
public void java.awt.Component.disable()
public final void java.lang.Object.wait(long,int) throws java.lang.InterruptedException
public final native void java.lang.Object.wait(long) throws java.lang.InterruptedException
public final void java.lang.Object.wait() throws java.lang.InterruptedException
public boolean java.lang.Object.equals(java.lang.Object)
public native int java.lang.Object.hashCode()
public final native java.lang.Class java.lang.Object.getClass()
public final native void java.lang.Object.notify()
public final native void java.lang.Object.notifyAll()

Program#main does appear in there.

Looking at the website you gave me, and unzipping the source code for Program, it appears to have a main method which checks whether the class being executed declares its own main method and throws an ErrorException otherwise.

How peculiar!
 
Campbell Ritchie
Marshal
Posts: 65821
250
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have changed the text colour for main so you can find it; I appear to have copied the same output twice so I shall delete one duplicate.
 
Ryan Needham
Greenhorn
Posts: 9
Mac Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:
Looking at the website you gave me, and unzipping the source code for Program, it appears to have a main method which checks whether the class being executed declares its own main method and throws an ErrorException otherwise.

How peculiar!



okay, so i need a main method?
 
Campbell Ritchie
Marshal
Posts: 65821
250
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. And I suspect you would be better following the course with ordinary Sun/Oracle classes.
 
Ryan Needham
Greenhorn
Posts: 9
Mac Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Yes. And I suspect you would be better following the course with ordinary Sun/Oracle classes.



So no ideas about why this is happening on OS X? because it worked seamlessly on linux and if i can i'd like to get it running the same on my preferred OS
 
Campbell Ritchie
Marshal
Posts: 65821
250
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It failed repeatedly for me on Ubuntu 14.04x64LTS/bash/JDK8u45.
If you go back to your stack trace you see the Exception is called acm.util.XXXException, so I think it is unlikely to be to do with the Java® installation. But I may be mistaken. It says something in the Program class about different Java installations, but I am not sure what that means. It used to be a party trick in this forum to run an app with no main method, but in Java7 that trick became impossible. But I think that is a red herring.

Anybody else?

I think this is no longer a “beginning” question so I shall move it and try duplicating it in the Mac forum in case it gets more attention there.
 
Liutauras Vilda
Marshal
Posts: 7185
492
Mac OS X VI Editor BSD Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, it worked (initial OP's code) without "main" method in "Hello" class on my:

Mac OS X 10.10.3
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

Compiled and ran in Eclipse environment
 
Wink, wink, nudge, nudge, say no more, it's a tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!