YAML Support for Java

I have a java program written which has to read a configuration file written using YAML (config.yml)
I downloaded the yamlbeans-1.0.jar* from http://yamlbeans.sourceforge.net/ which has the YamlReader class I am using in my java program. And I then copied the YamlReader.class file to the folder where I have my Testing.java program.
Please find my java and config.yml files below.
//JAVA FILE
class Testing
public static void main(String args[]) throws Exception
     YamlReader reader = new YamlReader(new FileReader("config.yml"));
     Object object = reader.read();
     System.out.println(object);
     Map map = (Map)object;
     System.out.println(map.get("NAME"));
//YAML file
NAME: mail.foobar.net
EMAIL_ADDRESS: [email protected]
AGE: 15
when I try to compile the java file, I get the following error.
C:\Users\David\Desktop\webstat\Testing.java:11: cannot access YamlReader
bad class file: .\YamlReader.class
class file contains wrong class: net.sourceforge.yamlbeans.YamlReader
Please remove or make sure it appears in the correct subdirectory of the classpath.
     YamlReader reader = new YamlReader(new FileReader("config.yml"));
     ^
1 error
Tool completed with exit code 1
Can some one please suggest me what has to be done to get YamlReader accessible in my program.
Thanks!

First, and most importantly, you didn't even give an example that can compile. But it is Friday and I'm in a decent mood. So I download the jar file. These are the exact steps I used:
mkdir yamltest
cd yamltest
cp ~yamlbeans-1.0.jar .
javac -cp yamlbeans-1.0.jar Testing.java
java -cp .:yamlbeans-1.0.jar TestingMy compilable program is:
import net.sourceforge.yamlbeans.YamlReader;
import java.io.FileReader;
import java.util.Map;
public class Testing {
    public static void main( String[] argv ) {
        try {
            YamlReader reader = new YamlReader(new FileReader("config.yml"));
            Object object = reader.read();
            System.out.println(object);
            Map map = (Map)object;
            System.out.println(map.get("NAME"));
        catch( Exception e ) {
            e.printStackTrace();
}The config.yml is like you show.
The output is:
$ java -cp .:yamlbeans-1.0.jar Testing
{NAME=mail.foobar.net, AGE=15, EMAIL_ADDRESS=[email protected]}
mail.foobar.netYou're not setting your classpath correctly.

Similar Messages

  • Queries on Mac OS X support for Java 1.3

    Hi All
    I am having some trouble figuring out how to make Swing based Applets
    work on Mac OS X. Can anybody help me ?
    Queries on Mac OS X support for Java 1.3
    1) Will a Java Applet compiled using Java 1.3 run on "Mac OS X" without the need for a Plugin.? This includes Applets using Swing since we compiled using 1.3.
    2) I tried to run some Java 1.3 applets compiled using 1.3.1-04.
    Unfortunately, the Applets wouldn't run.
    Is there some setting in Mac OS X that i need to change or modify for the Applet to work ?
    3) When i open a Terminal in Mac OS X and type Java -version, i get
    "------ Java 1.3---------".
    This implies that Mac OS X supports the Java 1.3 SDK. Does it imply that it supports the runtime as well since this is usually the case ?.
    If it supports the runtime, then does this inculde support for Swing.
    Finally, as i enquired in '(1)' does this mean that i do not need any plugin(MRJ) to make Swing based applets work.
    Thanks and regards
    Prashanth

    What I am seeing is that Java is throwing a security error when file io is initiated by an external call from Javascript to a file on the server that java should have access to. Here is the error.
    <<< ProxyClassLoader: defined LiveConnectProxy class. >>>
    <<< Here're the permissions you've got: >>>
    <<< java.security.Permissions@157402b (
    (java.net.SocketPermission www.dhba.com connect,accept,resolve)
    >>>
    VirtualLab.loadProblemSpecification: properties file=assignments/Walkthough.xml
    http://www.dhba.com/wested/applet/assignments/Walkthough.xml not retrieved
    java.security.AccessControlException: access denied (java.io.FilePermission assignments/Walkthough.xml read)
    My system:
    Mac OSX10.6.4 with Firefox3.6.12 (Java Plug-in 1.6.0_22 Using JRE version 1.6.0_22-b04-307-10M3261 Java HotSpot(TM) Client VM)

  • New in Kodo 3.3.3: Improved support for Java 5 enums and generics?

    Hello,
    Can anybody tell me if Kodo 3.3.3 can be deployed on WebLogic 8.1 sp4, jdk
    1.4.1? The reason I ask this is because one of the features mentioned for
    v3.3.3 is the support for Java 5 generics, which is available on WebLogic
    9 -- but not in WebLogic 8.1 sp4. The documentation for Kodo 3.3.3 seems
    to indicate that it can be deployed on WebLogic 8.1 -- can anyone tell me
    if this is accurate?
    Thanks for your help!

    Correction:
    I think that my question may have been misunderstood. What I want to know
    is if Kodo 3.3.3 can be deployed on WebLogic 8.1sp4 which is running JDK
    1.4 or do I have to deploy on a newer version of WebLogic that is running
    Java 5?
    Thanks!
    Rita wrote:
    I think that my question may have been misunderstood. What I want to know
    is if Kodo 3.3.3 can be deployed on WebLogic 8.1sp4 which is running JDK
    1.4 or do I have to deploy on a newer version of WebLogic that is running
    Java 4?
    Thanks!
    Stephen Kim wrote:
    Rita,
    While Kodo 3.3.x can work with JDK 5, it cannot make WL work with JDK 5.
    However, Kodo 3.4 RC 3 / 4.0 EA 2 both can work with WL 9 (which works
    with JDK 5).
    Rita wrote:
    Hello,
    Can anybody tell me if Kodo 3.3.3 can be deployed on WebLogic 8.1 sp4,
    jdk
    1.4.1? The reason I ask this is because one of the features mentionedfor
    v3.3.3 is the support for Java 5 generics, which is available on WebLogic
    9 -- but not in WebLogic 8.1 sp4. The documentation for Kodo 3.3.3 seems
    to indicate that it can be deployed on WebLogic 8.1 -- can anyone tell me
    if this is accurate?
    Thanks for your help!
    Steve Kim
    [email protected]
    SolarMetric Inc.
    http://www.solarmetric.com

  • ALERT - Support for Java Critical Patch Update

    ALERT - Support for Java Critical Patch Update
    On October 15th, Java released a critical patch update (CPU) which will require download and upgrade to the Java Runtime Environment (JRE) release – 1.7.0_45.   If upgrading the JRE to this release, the P6 module (also known as Web Access) of the P6 EPPM product line and the Contract Management product, which utilize LiveConnect applets in the browser, will start generating one or more prompts.   To remediate these prompts for the P6 EPPM Web Access module and the Contract Management product, Oracle Primavera will be releasing fixpacks.   Until fixpacks become available, you can use the following workaround to suppress these prompts:  Select the 'Allow' Prompt or 'Yes' prompt for successful loading of applets.  Note: This prompt will occur for each applet. 
    For more information, please refer to the following KM Documents in My Oracle Support.
    For P6 (Web Access), refer to KM Document ID 1591925.1
    For Contract Management, refer to KM Document ID 1592535.1

    I found the answer to my own question. For any newbies out there, if you create an account with Oracle, that is not enough to download patches. You have to have an Oracle Customer Support Identifier associated with your account. Once you have a CSI that you obtain through your employer who has paid for support or through some other means, you then can go into My Oracle Support and enter a request to be added to the given CSI. That request goes into a pending state until the administrator of the CSI grants you privileges to download patches. (NOTE: You might have to bug someone within your organization to get this to happen.) For me, once I was given the privilege, the link worked as it should.

  • Toplink support for Java 5.0

    I tried to import java classes, compiled with jdk 5.0
    into Toplink workbench. The mapping fails.
    I tried to run the workbench with jre 5.0 but that didn't work either.
    Does anyone know how to do it and does Toplink even have a version that supports java 5.0?

    Anna,
    TopLink 10.1.3 will offer formal support for Java 5.0. Currently the runtime should work fine with Java 5.0. The only issue may be the workbench mapping process depending on the version of TopLink you are using.
    If you are using the 10.1.3 preview the workbench will still run with JDK 1.4 but should be compatible with importing and mapping classes compiled with JDK5. We will upgrade the JRE used by the workbench to JDK5 for the production release but this should not make any difference to your ability to map JDK 1.4 or 5 classes and use either at runtime.
    If you are using 9.0.4.X then the workbench will not be able to run or import JDK5 compiled classes. I believe the runtime is fine but not certified. For this environment you will need to compile the classes under JDK 1.4 and map this version of the classes. You can then use JDK5 compiled version in conjunction with the runtime.
    I hope this helps,
    Doug

  • Please tell me Card that support for Java Card 2.2.2

    Hi Friends..
    Please tell me Card that support for Java Card 2.2.2..
    Thanks in advance..

    Hi Sebastien_Lorquet..
    Firstly, i'm so sorry if i'm mistaken and wrong.. i'm not mean to make you angry.. :(
    sorry about this..
    Yes, i've searched on google... and i think i'll buy it at NXP..
    Thanks in advance Sir.. :)

  • Oracle To End Support for Java 7

    No More Free Updates for Java 7 after April 2015
    Users must sign long-term support deals or migrate to Java 8 to avoid 'enormous headache and disruption to millions of applications'
    Public updates for Java 7 -- including bug and security fixes -- will end this month, a situation that one security advocate says could impact millions of applications.
    "As outlined in the Oracle JDK [Java Development Kit] Support Roadmap, after April 2015, Oracle will not post further updates of Java SE [Standard Edition] 7 to its public download sites," Oracle's Java SE Support Roadmap states. "Customers who need continued access to critical bug fixes and security fixes as well as general maintenance for Java SE 7 or older versions can get long-term support through Oracle Java SE Support. The process of migrating users from Java 7 to Java 8 through the auto update feature is expected to take place after the January 2015 CPU release."
    [ The art of programming is changing rapidly. We help you navigate what's hot in programming and what's going cold and give insights into the technologies that are changing how developers work. | Keep up with hot topics in app dev with InfoWorld's Application Development newsletter. ]
    Oracle released Java SE 7 in July 2011; Java SE 8 was released in March 2014. Java, particularly on the client side, has been beset by security issues in recent years. But Oracle has taken many steps to address the issues and stressed that most of the problems dated back several years, before Oracle took over Java from Sun in 2010.
    Still, the impact of Oracle's cessation of public updates could be severe, an official at security firm Waratek, believes. Oracle's "rapid" end-of-life schedule for Java versions is great for innovation and language evolution, Waratek CTO John Matthew Holt said in an emailed statement. "However, there is a dangerous tradeoff; now millions of Java 7 applications will have to defend themselves against code-level vulnerabilities without the benefit of future fixes." Holt advocates either upgrades to Java 8 or use of Java Run-time Application Self Protection (RASP) technologies (Waratek is a RASP vendor).
    This week's security update from Oracle, meanwhile, marks the "proverbial 'end of the road' for Java 7 application security, Holt said. "After today, the only version of the Java Platform which will receive public security updates is Java 8.  This is huge news, and it is going to cause enormous headache and disruption to millions of application owners around the world."
    Contacted Tuesday afternoon for a comment on the end of public updates for Java SE 7, by late evening Oracle had not yet responded.
    The April 2015 Critical Patch Update released Tuesday by Oracle provides 98 new fixes for security issues across a wide range of product families, said Eric Maurice in an Oracle blog post. These range from Oracle Database to Oracle Fusion Middleware, Java SE, and MySQL. Fourteen of the security fixes are for Java SE.

    Java 7 has already been dead for quite a while. While you could still use it for Java apps on your system, Apple blocked its use in browsers long ago. You have to install version 8 if you need Java support for the web.

  • Support for Java Server FAce in Workshop

    Dear All,
    Does anyone have any idea if and when Workshop will include support for the Java
    Server Faces (JSF) framework?
    Thank you
    Abe

    While I cannot share any specific product plans from any vendor, I would like to point out that all of the vendors of IDEs in the Java web application space are members of the JSR-127 expert group that is defining JavaServer Faces. Indeed, one of the primary design goals for the APIs is to ensure that development tools have sufficient information available to create high quality user interfaces at design time, so we're doing all we can to enable this kind of thing.
    As JavaServer Faces matures, I think you will be very pleased with the quality and quantity of tools support for it.
    Craig McClanahan

  • Support for Java Activation Framework?

    Hi,
    Can anyone quickly tell me which version of JAF (java activation framework)in
    WLS 7.0 ?
    thanks a lot in advance
    manoj

    Hello Kumar,
    Yes, these are part of HTTP 1.1 extensions. In case this is not currently supported, would really appreciate if you could let me know if it is planned in the future releases.
    Regards,
    Prasad Shetty
    Kumar Allamraju <[email protected]> wrote in message news:[email protected]..
    Are these extensions part of HTTP 1.1?
    Prasad Shetty wrote:
    Hi,
    I need to use some headers defined in HTTP Extension Framework
    (RFC 2274). Does Weblogic provide support for this extension
    framework ? If so which version of Weblogic should i be using ?
    Thanks & Regards,
    Prasad Shetty
    [att1.html]

  • Support for Java Server Faces

    I hope that in the next future will appear, on the market, IDE (such as JBuilder) or authoring tool (as Deamweaver), that support the creation of jsp pages. A sort of RAD for jsp+tag library.
    We expect such effort from software producer.
    Thanks
    Aldo Funicelli from Milan

    While I cannot share any specific product plans from any vendor, I would like to point out that all of the vendors of IDEs in the Java web application space are members of the JSR-127 expert group that is defining JavaServer Faces. Indeed, one of the primary design goals for the APIs is to ensure that development tools have sufficient information available to create high quality user interfaces at design time, so we're doing all we can to enable this kind of thing.
    As JavaServer Faces matures, I think you will be very pleased with the quality and quantity of tools support for it.
    Craig McClanahan

  • Coroutines support for Java

    Hello,
    I've just published library that adds support
    for Python-like coroutines to Java. You can see it at
    http://code.google.com/p/coroutines .It'd be great if you found that useful. All comments and feedback are greatly appreciated. Thanks.

    MarcinRzeznicki wrote:
    endasil wrote:
    MarcinRzeznicki wrote:
    Hello,
    I've just published library that adds support
    for Python-like coroutines to Java. You can see it at
    http://code.google.com/p/coroutines .It'd be great if you found that useful. All comments and feedback are greatly appreciated. Thanks.
    Cool. How did you accomplish it? By encapsulating a method within a thread? I don't really want to go to your site at this moment.Hi
    Not at all - I wrote Java instrumentation agent that makes the trick by transforming bytecode of original method to support coroutine semantics. Most of conceptual details are outlined on the site - check it out when you have time.Ahh, ok, so it's not so much a library as such. That's pretty cool, I'll take a look some time.

  • Does iPlanet App Server 6.5 provide support for Java Connector Architecture resource adapters? If not will 7.0?

     

    6.5 does not support JCA. 7.0 is announced on 19th June
    when the official statement regarding support for JCA
    will be made.

  • Any idea when we will get support for Java 7.5 in Safari?

    I'm in school for a degree in software engineering and Java is a big part of it.  As a regular Mac user who uses Safari as his main browser, it's disappointing that adoption of the latest Java versions in Safari seem to be lacking.  Is there any way to get Safari to look at the latest versions of Java instead of being stuck on Java 1.6?
    Thanks in advance for any help! :-)

    Apple has kept up to date (more recently) with the latest releases of Java 6 (1.6.0_33), which is the current public release of Java. You can install the development Java 7 runtime from Oracle (currently on build 5), but this will not support many features and functions of the final release. All future updates to Java will be issued and maintained by Oracle as it's done on other platforms. Apple will not be offering an in-house Java runtime after Java SE 6. You can get the latest Java updates here: http://www.oracle.com/technetwork/java/javase/downloads/index.html

  • Weblogic 10 support for java 1.4

    Hi,
    My application is currently running on weblogic 8.1 sp3. We are upgrading to weblogic 10 on Solaris 10.
    Can I run weblogic 10 on java 1.4 in Solaris 10.
    This may not sound logical, but I need answers.
    Thanks in advance,
    Rama

    Rama,
    You also need to consider the End of Life policy for JDK 1.4, unless you have a "Business Release" you will run out of support in October 2008. My understanding is BEA/Oracle will continue to support WL8 but only as far as they can. Have a look at http://java.sun.com/products/archive/eol.policy.html for more details.
    Regards, Geoff

  • Mac OS Support for Java plugin

    Is there a way to auto-install the Java Runtime and plugin for Mac browsers like Internet Explorer and Netscape?
    Do the <object classid...> tags work on Macs too?
    I do know that Mac OS X shipped with Java 1.3.1. But how can I find out if the plugin is supported by a Mac user's browser?
    thank you very much.

    See the outline above for fix to problem.

Maybe you are looking for

  • My iPod touch 4th generation turns off by itself. How can I fix this?

    My iPod Touch 4th generation turns off my itself. How can I fix this? This is not the first time this has happened. I usually hold down the home button and the power button at the same time for a few seconds and it'll turn back on but this time that

  • I can't burn a cd for my friend :(

    Someone please help! i was burning cd's for my friends yesterday and my comp was working just fine. Then i installed the new version of itunes yesterday. When i pressed the burn button today it says disc burner or software not found... . please help!

  • Installing RichFaces 3.1.0 with Netbeans 6.0 Visual JSF

    Hi: I am followning the installation instructions for Richfaces according to JBOSS's RichFaces developers Guide. The first step is to put the 3 jars's int the WEB-INF/lib directory. I added a library RICHFACES to netbeans and then added that library

  • Are tabs saved during an update?

    I've had tabs/browsing sessions lost during previous updates. When new updates come along I look thru FAQ etc to see if they'll be preserved. I never find anything about that, so I never update. Well, that's not true. FF invariably crashes and trashe

  • Cannot initialize CGI exec subsystem - Sun ONE Web Server 6.1

    Hello, I have a problem connecting to a running admin server on Solaris 9. Startup is as follows: (error log) [12/Mar/2004:11:06:43] info ( 2579): CORE1116: Sun ONE Web Server 6.1 B08/22/2003 12:37 [12/Mar/2004:11:06:43] info ( 2580): CORE3016: daemo