Change Contents of the Bubble
View this PageEdit this PageUploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

Questions on HW4-Sp2005

Questions on weaving music?


I'm getting this error:

Uploaded Image: problem.JPG
Here's a glimpse of my classpaths:

Uploaded Image: problem2.JPG

We couldn't figure it out (the problem) in recitation today. Any ideas?



Include jmusic the folder and jmusic/inst in your classpath. Mark Guzdial
Here's what my classpaths looks like:
Uploaded Image: myprefs.jpg


What do your imports look like, Tom? Maybe they're not right? Mark Guzdial


Actually, I had \jmusic, and \inst delineated. I got rid of them after someone suggested it, which yeah, seemed sort of silly. However, I was getting the same error with \inst and \jmusic. I'll just talk to you about this in class tomorrow, laptop in hand. Student34

Finally I have some time to work on this hw-
I'm sorry I didn't get to start on this earlier, but
I have used the "example" from the last powerpoint slide to see what it does so I can try to understand everything better.
Java tells me -"
Error: package jm does not exist"
when I have just inserted the example into dr.java. Why is that?
thanks!
Sounds like your classpath isn't set up right – see the discussion with Tom above and the screenshots of what it should look like. Mark Guzdial

so like...shorthand i can do jmc.c4 for c in the 4th octave. but what was shorthand for if i want a c# in the 4th octave??
JMC.CS4 – see page 28 in the course notes, the bullet list in the middle of the page. Mark Guzdial

awesome! thanks!!


i can't use SongNode or things like that b/c i get the same Error: cannot resolve symbol
symbol : method setTimeSignature (int,int)
location: class jm.music.data.Score
And I've got the right classpaths. ACK!

I have my extra class paths set up exactly like the picture above, yet im still getting the same error "cannot resolve symbol" Any ideas of what else the problem may be?

Check your imports. If you don't have the right imports, Java doesn't know where to look for those symbols. (If you want to type in any of the jMusic stuff in the interactions pane, you'll need to do the imports there, too, besides in your program.) Mark Guzdial


hmm..don't know if that's the issue.
for example, SongNode.java won't compile and i get the aforementioned error message, but it has these in it:
import jm.music.data.*;
import jm.JMC;
import jm.util.*;
import jm.music.tools.*;
are these not right?
Yup, those are right! Mark Guzdial

This is my error.

java.lang.UnsupportedClassVersionError: SongNode (Unsupported major.minor version 49.0)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at edu.rice.cs.util.classloader.StickyClassLoader._loadWithSecondary(StickyClassLoader.java:254)
at edu.rice.cs.util.classloader.StickyClassLoader.loadClass(StickyClassLoader.java:219)
at java.lang.ClassLoader.loadClass(Unknown Source)


So, I looked up unsupported class version and my results were 'Thrown when the Java Virtual Machine attempts to read a class file and determines that the major and minor version numbers in the file are not supported. '

I am not sure what this means. HELP!
Open the SongNode, SongPhrase, SongPart, and Song classes in the java-source directory and click compile all. That should fix the problem. Student24

Exactly as REMOVEDnny says! You're getting bit by the 1.5 vs. Java 1.4.2 bug. Just recompile and you'll be a happy camper! Mark Guzdial


Did all of that...definitely got the exact same error and everything. And all of them have the right imports. This is bad...
When it says something like this: "java.lang.UnsupportedClassVersionError: SongNode (Unsupported major.minor version 49.0)" it means that "SongNode.java" has to be recompiled. Open it, and click "Compile All." What file is it complaining about? Mark Guzdial

this is the error i'm getting in my interactions...
> java MYJMUSICSONG

NullPointerException:
at Song.show(Song.java:43)
at MYJMUSICSONG.main(MYJMUSICSONG.java:21)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)

What is it saying? What can I do to correct it?
What it's saying is that you have an error on line 21. "NullPointerException" typically means that you're using a variable that doesn't have a value yet–it's still "null". Mark Guzdial

nevermind, i figured it out (the above interaction problem)

DOES IT HAVE TO BE SHOWFROMMEON OR CAN WE USE .SHOW?
I updated the homework statement. If you use SongNode alone, you use showFromMeOn. If you use Song, you use show. Mark Guzdial


i wanted to do a repeat next then add an additional riff after that, but it's not letting me do that. it will either do the repeats or the setNext, but not both.

Are you getting some kind of error?

If you look at the code for repeat, you 'll see that it does NOT do an insertAfter–it simply slams in the copies. It'd be pretty easy to create a repeatAfter method that did insertAfter–I'd give extra credit for creating that method then using that.

If you just use setNext, then you simply lose the rest of the list – it disappears. Think about using insertAfter instead of setNext–that will save the reference to the rest of the list, too. Mark Guzdial


so i can put the notes in the songphrase class and make my main method for my class just make them nodes and arrange them and showfrommeon?
Yes but you wouldn't get the extra credit Student24

Possibly a dumb question, but what's the relationship between nodes and phrases?
A phrase contains a sequence of notes defined in an array. Nodes are chained together to create a linked list. Each Node contains exactly one phrase. A SongPart contains the first node in a chain and an instrument to play the chain with. A Song contains 1 or 2 songParts. Student24



Link to this Page