• Post Reply Bookmark Topic Watch Topic
  • New Topic

Learning JAXB  RSS feed

 
fahad akber
Greenhorn
Posts: 2
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,

I am trying to convert java object into a XML file using JAXB, but getting following errors in code.

Note:

- here i am not using any IDE, for code execution, just windows command prompt
- both files (Customer.java and JAXBExample.java) are placed in same directory.
- i m usiing jdk1.6.0_33




D:\Java_Web_Services\Test_Java_Code\JAXB\hello>javac JAXBExample.java
JAXBExample.java:19: cannot find symbol
symbol : variable JAXBContext
location: class JAXBExample
JAXBContext = jaxbContext = JAXBContext.newInstance(Cust
omer.class);
^
JAXBExample.java:19: cannot find symbol
symbol : variable jaxbContext
location: class JAXBExample
JAXBContext = jaxbContext = JAXBContext.newInstance(Cust
omer.class);
^
JAXBExample.java:20: cannot find symbol
symbol : variable jaxbContext
location: class JAXBExample
Marshaller jaxbMarshaller = jaxbContext.createMarshaller
();
^
3 errors


===========================

JAXB source code:
---------------------


 
gyank kannur
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to format your code before posting to the forum. Welcome to the Ranch!!
 
J. Kevin Robbins
Bartender
Posts: 1801
28
Chrome Eclipse IDE Firefox Browser jQuery Linux MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I added the code tags for you this time, since you can't edit your post once someone has responded to it. Here's link on how to UseCodeTags.

And welcome to the Ranch!
 
J. Kevin Robbins
Bartender
Posts: 1801
28
Chrome Eclipse IDE Firefox Browser jQuery Linux MySQL Database Netbeans IDE
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you understand classpath and using the -cp option of the javac compiler?
 
fahad akber
Greenhorn
Posts: 2
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
J. Kevin Robbins wrote:Do you understand classpath and using the -cp option of the javac compiler?


Hi Kevin, yes i understand the classpath option, i figure out the problem, it was a typo error in code on line 19

Thanks for editing the code

Fahad
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!