简体   繁体   中英

Codename one/netbeans downloading demos does not work

I have downloaded all the demos of codename one, netbeans. I import the projects. No demo works for me. It shows errors missing jar files, and no main classes. How do i fix this? See in picture.

showing all errors in downloaded projects

showing specific errors after pressing resolve, .jar missing

Update: Codename one settings does not work. 代号1设置

I suggest using File -> New -> Codename One -> Demos instead.

Otherwise you need to place the right jars into the projects as they aren't included in git: https://www.codenameone.com/blog/tip-setup-codename-one-demo-from-git.html

I also struggled to get the demos working from the GitHub download, but that is the wrong approach. Shai's answer has already provided the solution, and this post is just expanding on that to clarify the exact steps required in NetBeans.

Step 1 of 3: Install the CodenameOnePlugin plugin:

  • Tools > Plugins > select the Available Plugins tab.
  • Select and check CodenameOnePlugin , then click Install .
  • The plugin will be installed and you will be invited to restart NetBeans, so do that.

Step 2 of 3: Create one of the Demos projects:

  • Select File > New Project .
  • After installing the plugin and restarting NetBeans, in the New Project dialog there is a new category named Codename One with a sub-category named Demos .
  • Select Demos and then select one of the projects from the Projects list such as CameraDemo and complete the New Project wizard:

selectProject

  • Open one of the Java source files. You will see that there are no errors for unresolved imports.

Step 3 of 3: Run the demo project you just created.

  • Select the demo project you chose to create in the Projects tab, then press F6 to run it.

That's all there is to it! No downloading is needed, apart from installing the plugin. However, I did hit a couple of very minor issues:

  1. During project creation some of the projects have the same default name of Demo . Just pick another name.

  2. There is a build problem with certain projects such as Charts :

Unsupported source/binary format (in Charts)

The project source/binary format is older than minimal supported one (1.6).

The solution is simple:

  • Select the project in the Projects tab.
  • Right-click and select Properties .
  • Select Sources and then update the value of Source/Binary format to 1.8 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM