Skip to main content

hdcookbook source - configure in eclipse, build and run

14 replies [Last post]
javanetforme
Offline
Joined: 2010-06-05

Hi All,

This is for all BDJ starters who want to configure hdcookbook source in eclipse, build and run applications(eg. bookmenu).

Prerequisites:

1. Registered account at www.java.net
2. classes.zip (http://java.sun.com/javame/reference/bluray-technote.html)
3. Tortoise SVN.

Follow the steps below:

1. Create a new folder anywhere in your hard drive.
2. right click this folder and checkout hdcookbook source from https://hdcookbook.dev.java.net/svn/hdcookbook/trunk. This will ask for your registered userid and password at java.net.This folder has folders such as 'AuthoringTools', 'DiscCreationTools' etc. and files such as build.xml, vars.properties etc.
3. Under this source folder, create a new file called 'user.vars.properties'. Open to edit this file and add HDC_BDJ_PLATFORM_CLASSES=. Save and close.
4. Now open command prompt, change to the source directory and execute command 'ant tools'. This will build source under AuthoringTools and DiscCreationTools.
5. Open eclipse.
6. Right click - new - java project. Enter your project name, select 'Create project from existing source' - browse to 'your source directory/xlets/hdcookbook_discimage' - click ok - finish. The project will be created in eclipse.
7. Right click on the project in package explorer - build path - Configure build path - click on 'Libraries' tab - click on 'Add External JARs' - add 'classes.zip' in your hard drive. Same way, add 'grincompiler.jar' from 'your source directory/AuthoringTools/grin/build/jdktools/compiler'. This jar is generated in step 4.
8. click ok. All errors are should now resolve and the project is ready to be built.
9. Open command prompt, change to 'your source directory/xlets/hdcookbook_discimage'. Execure command 'ant'. This will build the project and create appropriate folders and files. The discImage is created under dist/DiscImage.
10. Drag folder 'BDMV' in any BD software player such as TotalMediaTheatre or PowerDVD.

Same procedure can be followed for other individual applications such as HelloWorldXlet etc.

Hope this helps.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
paulemasters
Offline
Joined: 2011-12-07

Hello:

While I am not new to programming, I am new to JAVA et all. Thanks for this list of exactly what to do to set things up.

Unfortunately, the link in step 2 doesn't exist. Is it somewhere else now?

Thanks.

Paul Masters

billf
Offline
Joined: 2004-02-13

You mean the HD cookbook repository in step 2, and not the classes.zip in prerequesite 2, right?

Go to http://hdcookbook.dev.java.net, and it will redirect you to where Oracle put it in java.net's new structure. Then click on "Source Code", and it will give you a link.

I put "/trunk" at the end of what it gives me, which is SVN for "the main project branch." So I use a command like:

svn co <link the web site gives me>/trunk hdcookbook

to put the main branch (the "trunk") in the local directory hdcookbook.

Cheers,

Bill

paulemasters
Offline
Joined: 2011-12-07

Thanks for the quick response.

As I say, I am very new with all this, so please excuse 'dumb' questions. So, I am to download all the files in the /trunk list and read all the readmes? Any suggestion on where to start or what to do with all of that? I have used Eclipse at my former work, but that was with very detailed instructions - I had no idea what I was doing.

I have been trying to run the sample provided else where on this forum using NetBeans. However, no matter what I do I get an error in the compile. One is that java.lang can't be found. When I fix that, I get a list of errors about the BDJ related items not being found. I added the BDJ folder to the Windows (7 64bit Ultimate) CLASSPATH. I changed the name referenced in the build script in the project build.properties. I removed the bootCLASSPATH from the build script. Nothing seems to work.

I copied the code and created a new JAVA project. That created a lot of errors. I happened to discover that the template could be changed and noticed there was one for BDJ - changed to that, now I get errors from java.lang (and others) NoClassDefFoundError. Other changes result in the BDJ classes not being found again.

Like one of the posts said, I may be reading too many 'how to do things', but none of them seem to work in one way or the other. I realize that most are old and that this environment changes quickly.

I have programmed mainframes for over 40 years using many languages, but Java and I don't seem to understand each other. There are so many pieces in so many different places and some appear to be duplicates. I am lost.

Any help you can be would be very very appreciated.

Thanks.

Paul Masters

billf
Offline
Joined: 2004-02-13

Hi Paul,

Well, first a warning. Putting together a Blu-ray disc has a lot of moving parts, and the process isn't nearly as turn-key as is the case for larger developer communities, like iOS or Android. The cookbook project was put together at Sun Microsystems, back before the Oracle days, and the four of us who were the primary developers have all moved on from Sun/Oracle. Two of us are still in BD, though. We didn't really use IDEs much. Personally, I'm more of a vi and command-line person - Unix is my "ide" of choice :-) We did get NetBeans up and running, and a lot of folks have gotten Eclipse set up to do this stuff, but it does takes some fiddling. Maybe some of the folks who use IDEs more will have some pointers.

There is a wiki, over at http://java.net/projects/hdcookbook/pages/Home. That has instructions on how you assemble the all-important platform definition "compilation stubs." There is also a README.pdf at the base directory that's more-or-less up to date, and there are a bunch of sample projects. We're pretty good at having a reasonable README for each one, but it will take some digging and reading through REAMDE files and experimentation to figure out how the pieces fit together. Getting the hardcopy HD Cookbook book is helpful -- our readmes probably say things like "This is a tool to create a BDJO." The book is where you'll find things like a description of what the heck a BDJO is. (It's meta-data about how to launch Java code on a disc.)

Being command-line centric, the assumption behind the project is that to build something, you go into the relevant directory and type "ant." That's how NetBeans usually builds things. We didn't use Eclipse -- remember, at the time, Sun was pretty dead set against Eclipse, which started life as IBM's attempt to exert more control over the JavaEE platform ("Eclipse blocks the Sun" was how folks at IBM put it). Eclipse wants to own more of the build process than NetBeans does, so to really get Eclipse working well you'll probably need to spend a fair bit of time fiddling with it.

Anyway, for ant, there's usually a build.xml file in each directory, which includes the files user.vars.properties and vars.properties, in that order. You need to tell it where you've put the platform definition (those java stubs!); you do that by creating a file called user.vars.properties that overrides the relevant variable (bdj.classes) from vars.properties. When you set up your own project (if you use the GrinXlet framework), your user.vars.properties file also needs to contain cookbook.dir, to tell us where you've installed the cookbook project.

I'm sure it takes a fair bit of exploring around to figure out all the pieces, but once you have it works well. For a simple xlet, I can go from idea to working disc in a player in maybe 30 minutes; the project setup isn't hard and takes a minute or two. It took a *ton* of time to get the build system to this state, but we didn't make turn-key wizards that were fully integrated into an IDE. Part of the reason why is because everyone wanted that for Eclipse, and we were limited to NetBeans (due to the whole eclipse blocking the Sun thing). The other is that IDEs tend to change out from under you, so that kind of environment takes active support (whereas ant and vi are pretty stable by now). Once you get past the build system, there's a desktop emulator that works well (assuming you write your code to isolate out the parts that depend on the BD platform), and some really great tools for building and exploring the Blu-ray disc structure. It's all been used in production, so it's quite solid.

Best of luck.

Cheers,

Bill

paulemasters
Offline
Joined: 2011-12-07

Hello:

Thanks for your time and the long explanation. I know what you mean about 'being the first'. I just completed a JavaScript for PhotoShop to automate HDMV menus In/Out Effects using IGEdit. It took 6 months. Mainly because I had to figure nearly all of it out on my own. DVDLogic was kind enough to send me an example of a menu, but they couldn't answer my questions because they aren't authors, they only write the programs they don't use them. (I can understand that. I have been in that position before. But they should have been able to tell me what the PARMs did!)

Anyway, I have already seen the Oracle pages (there are 2 depending on the link you use and they provide different named files) to download the different pieces. I have the official BDJ from the BDA (much quicker and easier than I expected it to be). I have unzipped all to a folder: BDJ Classes, which now contains 7 folders and 2 jar files (May be I picked up some things that I don't need). I went to the page you mention and to the page mentioned in the script - been there before. As stated, I had already unzipped the files to a folder. Then from the command prompt, I switched to E:\BDJ Classes and and entered: javadoc -use -d dist -subpackages org -subpackages java -subpackages javax -sourcepath src As shown in the script. I received the following messages: Creating destination directory: "dist\" Constructing Javadoc information... javadoc: error - No public or protected classes found to document. 1 error

So, there is obviously something I am doing wrong but I have no clue as to what it is.

I probably should have warned you before. Things happen to me that don't happen to others. I have been accused of looking for problems, but I assure you that I don't. They just find me. I would rather that everything work the first time - much less frustration that way.

To continue. In Getting a BD-J Platform deffinition page: The zip files I have are not named as shown in the script, except for the GEM one. I copied all to folder originals and renamed the zip files to match those listed. They all have a single folder with the name listed in the script. I am stuck on the BDA file as there are two: V2.41-Part3-2_JavaStub.zip and V2.41-Part3-2-AnnexBB+AnnexFF-Javadoc.zip. So which do I use? (If both, I gather I need to modify the script.) (I don't understand all of what the script is doing but each ZIP has one folder and that folder has multiple folders which each may have folders - all may or may not have .java files.)

Additionally, I tried to run a 'shell' file from the command line before and got a 'not valid' message. These look like what were called BAT files in the DOS days. (I wrote BAT files many many years ago.) Do they require something else to run?

Thanks for your patience and help.

Paul Masters

(PS: I don't have to use Eclips. NetBeans is OK. I got that because the Java ME indicated it needed it. I was checking out the Eclips item because the one using NetBeans didn't work. I was having problems getting all the classes to be accessed at one time. I could get the BDJ ones to work but got message about java.lang. When I got rid of that, the BDJ classes were not there. I thought of Eclips because the person I was asking for help has worked with Java for a while and uses Eclips. Like I say, either is fine. I just want to find something that works. Thanks.)

billf
Offline
Joined: 2004-02-13

Hi Paul,

To start near the beginning, "shell" is just the Unix name for what Windows calls a command prompt. It's also a scripting language. By today's standards it's pretty quirky, but for people like me who have been using it for decades, it's often the easiest way to string a bunch of commands together. The commands that one strings together in a shell script tend to be Unix commands themselves.

Generally speaking, the cookbook project is pretty Unix-y. It works fine on Windows, but you'll probably want Windows versions of some of the more common Unix tools, like a shell (probably either "sh" or "bash"), and ant, and a handful of others. There's a package called "Cygwin" that I think works OK. Or, if you have a Mac or Linux box you can get to, you might want to move over there, at least while you're getting set up.

I think you should use the "Part 3-2_JavaStub" zip files. The thing to look for is .java files under org/bluray. It sounds like maybe the other file has pre-built javadocs in it? The thing you want is .java files for all of the classes that form the public API. The script unzips the various archives containing these stub .java files, and compiles them using javac, giving a bunch of .class files that get stuffed into a .zip file that you can build xlets against. It also runs javadoc for you, so you get a set of HTML pages with unified documentation of the API set.

Cheers,

Bill

paulemasters
Offline
Joined: 2011-12-07

Hello!

Thanks for all your patience and help. I finally got the first sample to work in NetBeans! (Hello BD-J World). Not only that I made a change to the text and that worked as well.

I got Cygwin. Initially I didn't download / install everything because there is so many parts that I don't want or need, but when clicking on the terminal shortcut a window said: minty /usr/bin/mintty: could not load icon from '/Cygwin-Terminal.ico' I thought I skipped something I shouldn't have so I had it download and install everything (nice installer by the way). But the terminal gave the same message. (Later while looking for something else I saw that file in the base folder and windows could display it OK.)

I selected rxvt native (because it didn't say Unicode) for a command window. Once I figured out how to select a drive and switch to a folder, I ran the build.sh. However, there still seemed to be a problem. Unfortunately, I could not see all the output in the command window. At that point, I created a new folder, put the original folder in it and the script. Then switched to that folder in the command window and ran the script again. That time it appeared to work. (I guess I didn't hold my mouth right before (g).)

At least I think it ran OK. The folders are there and have html and classes.zip with items in them. But the last line said there were 248 warnings. I could find no way to see all the output in the command window. Do you know of a way to see the complete 'listing'? I looked for a log by searching for all files created today, but did not find one. It would be nice if there were a way to see all of the messages produced. The display paused a few times, but I was not able to read anything.

I gather from the comments in the script that the interactive classes are to be used if the project is to connect to the WEB and the enhanced classes are to be used if not. Is that correct?

On to new frontiers. The first is to see if I can get TMT3 to work automagically as I don't have WinDVD. I saw a post somewhere on the forum about that.

Thanks so much again. Unfortunately for you, you likely will hear from me again.

Paul Masters

billf
Offline
Joined: 2004-02-13

Hi Paul,

Glad it worked! And thanks for detailing all the steps with cygwin -- that could help the next people who try this.

Don't worry about all the warnings. They're harmless.

You're correct - "enhanced" means "no network APIs," and "interactive" means "has network APIs." It's a little funny, in that java.net.Socket (for example) is in the enhanced profile, it just can't be used to connect to anything on a device that physically doesn't have networking hardware. The SSL APIs, like javax.net.SSLSocket, are only present on interactive devices. The names "enhanced" and "interactive" come from MHP and date back over a decade; the BD-J name for enhanced is "Profile 1."

Cheers,

Bill

paulemasters
Offline
Joined: 2011-12-07

Hello:

A friend who works with Java and Unix told me about piping (did that in DOS BAT files in the 1970s but I forgot). I deleted all the generated folders and ran the script again with > build.txt. That worked, sort of. The file had the output of the commands but not the commands themselves. I looked at the errors in the command window and those I could see appear to be related to the javadoc - the documentation must not conform to what it is looking for.

I was able to use the NetBeans plugin to run the first 'Hello World' sample and made some small changes to it and ran it again. All was as expected using TMT3 as a player. With some problems / confusion I was able to get the remote button sample to run. For some reason, you can't change the project name or the XLET name. That appears to be related to a Java convention? Is there a way to do that? Also, the BDJO file is generated with the names so if any others are used, the disc won't play.

I added code to the remote button sample and found that TMT3 doesn't respond to the number buttons, which is interesting as the on screen remote has them. (Although thinking about it, there were no chapters or titles, so TMT3 may be 'smart' and not respond to the numbers in that case. However, I burned a disc and my Panasonic player did respond.

***

A different topic. I am sure I messed something up by not knowing. I used Tortoise SVN to get the cook book files. But I then copied them to another folder. I now see there is an update. I tried to check them out again but get 'Encountered an improper argument'. I tried an export and got the same message. I was signed on to the site when I did both. Another strange thing. When I am signed on and click on the 'get source code' it displays: https://svn.java.net/svn/hdcookbook~svn svn+ssh://paulemasters@svn.java.net/hdcookbook~svn I uninstalled Tortoise and cleaned the registry and reinstalled it but I get the same message.

Any help will be greatly appreciated.

Paul Masters

billf
Offline
Joined: 2004-02-13

If you want to see the commands the shell script is running, change the first line from "#!/bin/sh" to "#!/bin/sh -x". Nobody said Unix commands were anything but cryptic! The javadoc warnings you're seeing are mostly because javadoc got a lot better -- and more picky -- over the years. A lot of the platform source files you're running javadoc over date back to JDK 1.3, and the version of javadoc you're running is much newer. It's mostly detecting inconsistencies and deviations from style guidelines that weren't nearly so well formed when JDK 1.3 was current.

Beats me about svn! The new java.net site does give a strange-looking URL to svn, and it embeds your user name if you're logged in. That's what I use; I just remember to append "/trunk" to it, and give the command-line version of svn that I use (which comes with Mac) the extra argument "hdcookbook", so it doesn't call the directory on my local system "trunk". So I do:

svn co <URL from java.net>/trunk hdcookbook

and it works fine. I suspect the stuff with my login ID in the URL is important for doing putbacks.

Cheers,

Bill

billf
Offline
Joined: 2004-02-13

If you want to see the commands the shell script is running, change the first line from "#!/bin/sh" to "#!/bin/sh -x". Nobody said Unix commands were anything but cryptic! The javadoc warnings you're seeing are mostly because javadoc got a lot better -- and more picky -- over the years. A lot of the platform source files you're running javadoc over date back to JDK 1.3, and the version of javadoc you're running is much newer. It's mostly detecting inconsistencies and deviations from style guidelines that weren't nearly so well formed when JDK 1.3 was current.

Beats me about svn! The new java.net site does give a strange-looking URL to svn, and it embeds your user name if you're logged in. That's what I use; I just remember to append "/trunk" to it, and give the command-line version of svn that I use (which comes with Mac) the extra argument "hdcookbook", so it doesn't call the directory on my local system "trunk". So I do:

svn co <URL from java.net>/trunk hdcookbook

and it works fine. I suspect the stuff with my login ID in the URL is important for doing putbacks.

Cheers,

Bill

paulemasters
Offline
Joined: 2011-12-07

Hello!

Thanks for the quick response!

I forgot about running SVN from a command window and adding /trunk. I know you said that before, but I guess I didn't read it this time. I tried what the top of the thread said about going to the folder and right clicking. I tried the link with /trunk there and got the same message. However, using your text in the command window worked fine.

This time 'ant tools' worked.

Thanks for all the help. Sorry you had to repeat yourself.

***

Unfortunately, I need more help. That is, what do I do now?

I have read all the Wiki pages. I bought the book a long time ago (meant to mention that more than once but kept forgetting due to the problems). I am really swamped with all the pieces and parts. If I can just figure out where / how to start, perhaps that pattern will show me how to continue. With something new (or something big) I start with little 'tests' - like the first two samples - to see how something is done. In the mainframe world it's called 'structured programming'. I know that the more I do, the more I will find that I can do. I think I finally have all the needed software. But right now, I don't know where the first page is.

Thanks for all your time and patience with a very novice person.

Paul Masters

billf
Offline
Joined: 2004-02-13

Hi Paul,

There are a bunch of little demo xlets that can serve as a starting point. The place to look is <cookbook directory>/xlets.

HelloWorldXlet contains a minimal project to build a disc image that puts "hello world" on the screen. It doesn't use any framework code from the project, so if you want a starting point for "raw" Java, this is it.

The rest of the demos tend to use the GRIN framework, which is the scene graph introduced on page 23-10 of the book. They also use the "GrinXlet" container, which is xlet code that's set up to load a GRIN "show" and run it. All these are current. Under xlets/demos, there are three demos we showed at various JavaOne conferences and other events. "big_shoe" is a simple shooting game, and there are two "widget"-like xlets (in the Yahoo widgets sense) to show weather and a twitter feed. xlets/grin_samples has smallish samples, all the way up to GrinBunny, which is a rewrite of the Space Invaders-like game that was in the book. xlets/tests/functional have small programs that test one specific area -- usually written when the tool support for that area was created, so we had a way to test it.

Some of the samples are a little dated. For example, grin_samples/GrinDriverXlet is a stand-alone equivalent to what was later made into the configurable GrinXlet. Hopefully the various README files are enough to figure out what you want to look at. Most of them are pretty small, and meant to show off (or test!) a specific aspect of BD-J and/or GRIN.

The GrinXlet-based demos are structured as though they were independent projects, so the following pattern will work:

* Copy directory somewhere else on your hard disk

* Strip out the svn directories

* Write a user.vars.properties file that overrides bdj.classes and cookbook.dir

* Type "ant grinview" to run the desktop emulator. In most (all?) of the examples, double-clicking S:Initialize launches the GRIN "show". (S:Initialize is just a naming convention we followed; grinview is a desktop debug/emulation tool).

* Type "ant" to build a disc image. It will show up in the directory "dist"

Once that works, you can modify names and such in vars.properties, change the source, and so forth.

In BD-J, names tend to be repeated in multiple places. For example, the name of the main Xlet class appears in the name of the permission request file, AND in the BDJO, and probably other places. It can be a real pain to set up, because if you change the name in one place but not another and you burn a disc, it will usually just do nothing. That's one nice thing about the GrinXlet container -- Chihiro put together a very elaborate ant build file that reads the relevant names from one place (vars.properties), and propagates them to all the places they need to go.

Have fun!

Cheers,

Bill

paulemasters
Offline
Joined: 2011-12-07

Hello:

Thanks for the pointers. I'll give them a try.

Hopefully I won't need to bother you for a while (g).

Paul Masters