Auto-Generated Libgdx Code And One Other Thing

I just installed lbgdx or however the abbreviation goes and I have two questions. The first is, does lbgdx work like lwjgl and stuff like that where I just add them to the project and start using the classes right away? The second is, do I need to keep the code below that was auto-generated when I ran gdx-setup-ui.jar?

/*******************************************************************************
 * Copyright 2011 See AUTHORS file.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ******************************************************************************/

package com.badlogic.gdx.utils;

import com.badlogic.gdx.jnigen.AntScriptGenerator;
import com.badlogic.gdx.jnigen.BuildConfig;
import com.badlogic.gdx.jnigen.BuildExecutor;
import com.badlogic.gdx.jnigen.BuildTarget;
import com.badlogic.gdx.jnigen.BuildTarget.TargetOs;
import com.badlogic.gdx.jnigen.NativeCodeGenerator;

/** Builds the JNI wrappers via gdx-jnigen.
 * @author mzechner */
public class GdxBuild {
	public static void main (String[] args) throws Exception {
		String JNI_DIR = "jni";
		String LIBS_DIR = "libs";

		// generate C/C++ code
		new NativeCodeGenerator().generate("src", "bin", JNI_DIR, new String[] {"**/*"}, null);

		// generate build scripts, for win32 only
		// custom target for testing purposes
		BuildTarget win32home = BuildTarget.newDefaultTarget(TargetOs.Windows, false);
		win32home.compilerPrefix = "";
		win32home.buildFileName = "build-windows32home.xml";
		win32home.excludeFromMasterBuildFile = true;
		BuildTarget win32 = BuildTarget.newDefaultTarget(TargetOs.Windows, false);
		BuildTarget win64 = BuildTarget.newDefaultTarget(TargetOs.Windows, true);
		BuildTarget lin32 = BuildTarget.newDefaultTarget(TargetOs.Linux, false);
		BuildTarget lin64 = BuildTarget.newDefaultTarget(TargetOs.Linux, true);
		BuildTarget android = BuildTarget.newDefaultTarget(TargetOs.Android, false);
		BuildTarget mac = BuildTarget.newDefaultTarget(TargetOs.MacOsX, false);
		new AntScriptGenerator().generate(new BuildConfig("gdx", "../target/native", LIBS_DIR, JNI_DIR), mac, win32home, win32,
			win64, lin32, lin64, android);

		// build natives
		// BuildExecutor.executeAnt("jni/build-windows32home.xml", "-v");
		// BuildExecutor.executeAnt("jni/build.xml", "pack-natives -v");
	}
}

It gave me a compile error right off the bat so I was just about to get rid of it but then I thought to ask first. The error it gave is below if anyone was wondering.

Exception in thread "main" java.lang.NoClassDefFoundError: com/badlogic/gdx/jnigen/NativeCodeGenerator
	at com.badlogic.gdx.utils.GdxBuild.main(GdxBuild.java:34)
Caused by: java.lang.ClassNotFoundException: com.badlogic.gdx.jnigen.NativeCodeGenerator
	at java.net.URLClassLoader$1.run(Unknown Source)
	at java.net.URLClassLoader$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	... 1 more

PS: What’s with these topic title restrictions? I had to change my topic title three different times just to post this, the title looks ridiculous now.

Erm, the setup ui doesnot generate this file at all.

Yep, it did. I created a new project following the steps on the libgdx site and this is what was inside of the main class that it generated.

I wrote that stuff, i’m pretty sure i know what it generates. You must have introduced an error somewhere along the steps.

You are probably trying to run the GdxBuild class, which is likely somewhere in your class path.

If you want to run the desktop project, you should right click it (i.e. “myproject-desktop”) and click “Run” – you might need to specify the target in “Run Configurations.” Your target should be the Main class in your desktop project.

If you only plan on targeting desktop (i.e. no desire to use Android/iOS), you can just follow these steps:

Thanks, that worked. ^.^ Time to go figure out how to use libgdx now!