java.lang.IllegalArgumentException: Not a valid class name: ANDROID NDK javah

Paul Asiimwe 08/22/2017. 6 answers, 9.039 views
android-ndk android-ndk jni adt

Im learning to code Android in NDK on WINDOWS Eclipse.... been following a Tutorial Book by Sylvain Ratabouil. So im in Run | External Tools | External Tools Configurations… creating a new program configuration.

Name: MyProject javah

Location : ${env_var:JAVA_HOME}\bin\javah.exe

Working directory: ${workspace_loc:/MyProject/bin}

The problem comes In arguments... when i try Arguments: –d ${workspace_loc:/MyProject/jni} com.myproject.MyActivity as it says in the book

i get when i click run

Exception in thread "main" java.lang.IllegalArgumentException: Not a valid class name: –d

when i try ${workspace_loc:/MyProject/jni} com.myproject.MyActivity}

i get

Exception in thread "main" java.lang.IllegalArgumentException: Not a valid class name: C:\Paul\Workspace\MyProject\jni

UPDATE: i put -classpath first and it's running but can not find the class file for com.myproject

1 Comments
Guilherme 08/31/2014
Funny, this don't worked for me. I'm in mac. This solved stackoverflow.com/questions/9200373/…

6 Answers


Paul Asiimwe 07/13/2013.

after further research.... i did it.

i set arguments to

-d ${workspace_loc:/MyProject/jni} -classpath C:\Paul\android-sdk-windows\platforms\android-17\android.jar;${workspace_loc:/MyProject/bin/classes} com.myproject.MainActivity


Julian 07/22/2014.

I also spend some long time on this problem when working with the the mentioned book about Android NDK.

Please note the following: The java classname is NOT written in { }, just write something like com.myproject.MyActivity

The -classpath parameter can receive several paths devided by semicolon.

In my case this parameters worked:

Location:

${env_var:JAVA_HOME}\bin\javah.exe

Working Directory:

${workspace_loc:/myproject/bin}

Arguments:

-d ${workspace_loc:/myproject/jni} -classpath ${workspace_loc:/myproject/bin/classes};"C:\Eclipse\sdk\platforms\android-18\android.jar" com.myproject.MyActivity

(BTW.: The correct Adroid.jar file is referenced inside the Eclipse project.)


community wiki 12/20/2014.

Me also facing the same problem tonight, i found a less tedious way as following...

  1. as "Location" set the javah from your system
  2. as "Working directory" set the project's bin/classes directory (${workspace_loc:/HelloWorld/bin/classes})
  3. as "Argument" set the jni folder as the output directory and point out the class on which you want to run the javah (-d "${workspace_loc:/HelloWorld/jni}" com.example.helloworld.MainActivity)

NB :: Dont forget the double qoute (") around the output in the third step ("${workspace_loc:/HelloWorld/jni}")

A full picture is also attached following

All 3 steps in a single picture


Saket 06/29/2014.

well in case ...

1-> Goto ( cd C:\Program Files\Java\jdk1.7.0_60\bin)

2-> C:\Program Files\Java\jdk1.7.0_60\bin>javah -jni -classpath F:\Android_OpenGLES\FibonacciNative\bin\classes -d F:\Android_OpenGLES\FibonacciNative\jni\ com.example.fibonaccinative.FibLib

without creating/using environment variable ...


CoDe 08/12/2015.

Following I tried successfully

javah com.sense.kios.Calculation

Note: Include package name.

In case if javah not found as an command and you getting

The program 'javah' can be found in the following packages:
 * gcj-4.6-jdk
 * gcj-4.7-jdk
 * openjdk-7-jdk
 * openjdk-6-jdk
Try: sudo apt-get install <selected package>

use direct path of jdk path, in my case it's /usr/lib/jvm/jdk1.8.0/bin/javah.


Dhiraj Himani 07/29/2017.

YES THAT'S CORRECT more abstract would be

-d ${workspace_loc:/MyProject/jni} -classpath ${env_var:ANDROID_SDK_HOME}\platforms\android-16\android.jar;${workspace_loc:/MyProject/bin/classes} com.myproject.MyActivity

HighResolutionMusic.com - Download Hi-Res Songs

1 (G)I-DLE

POP/STARS flac

(G)I-DLE. 2018. Writer: Riot Music Team;Harloe.
2 The Chainsmokers

Beach House flac

The Chainsmokers. 2018. Writer: Andrew Taggart.
3 Ariana Grande

​Thank U, Next flac

Ariana Grande. 2018. Writer: Crazy Mike;Scootie;Victoria Monét;Tayla Parx;TBHits;Ariana Grande.
4 Nicki Minaj

No Candle No Light flac

Nicki Minaj. 2018. Writer: Denisia “Blu June” Andrews;Kathryn Ostenberg;Brittany "Chi" Coney;Brian Lee;TJ Routon;Tushar Apte;ZAYN;Nicki Minaj.
5 Clean Bandit

Baby flac

Clean Bandit. 2018. Writer: Jack Patterson;Kamille;Jason Evigan;Matthew Knott;Marina;Luis Fonsi.
6 Imagine Dragons

Bad Liar flac

Imagine Dragons. 2018. Writer: Jorgen Odegard;Daniel Platzman;Ben McKee;Wayne Sermon;Aja Volkman;Dan Reynolds.
7 Halsey

Without Me flac

Halsey. 2018. Writer: Halsey;Delacey;Louis Bell;Amy Allen;Justin Timberlake;Timbaland;Scott Storch.
8 BTS

Waste It On Me flac

BTS. 2018. Writer: Steve Aoki;Jeff Halavacs;Ryan Ogren;Michael Gazzo;Nate Cyphert;Sean Foreman;RM.
9 BlackPink

Kiss And Make Up flac

BlackPink. 2018. Writer: Soke;Kny Factory;Billboard;Chelcee Grimes;Teddy Park;Marc Vincent;Dua Lipa.
10 Fitz And The Tantrums

HandClap flac

Fitz And The Tantrums. 2017. Writer: Fitz And The Tantrums;Eric Frederic;Sam Hollander.
11 Backstreet Boys

Chances flac

Backstreet Boys. 2018.
12 Kelly Clarkson

Never Enough flac

Kelly Clarkson. 2018. Writer: Benj Pasek;Justin Paul.
13 Diplo

Close To Me flac

Diplo. 2018. Writer: Ellie Goulding;Savan Kotecha;Peter Svensson;Ilya;Swae Lee;Diplo.
14 Anne-Marie

Rewrite The Stars flac

Anne-Marie. 2018. Writer: Benj Pasek;Justin Paul.
15 Little Mix

Woman Like Me flac

Little Mix. 2018. Writer: Nicki Minaj;Steve Mac;Ed Sheeran;Jess Glynne.
16 Imagine Dragons

Machine flac

Imagine Dragons. 2018. Writer: Wayne Sermon;Daniel Platzman;Dan Reynolds;Ben McKee;Alex Da Kid.
17 Little Mix

The Cure flac

Little Mix. 2018.
18 Bradley Cooper

Always Remember Us This Way flac

Bradley Cooper. 2018. Writer: Lady Gaga;Dave Cobb.
19 Rita Ora

Velvet Rope flac

Rita Ora. 2018.
20 Lady Gaga

I'll Never Love Again flac

Lady Gaga. 2018. Writer: Benjamin Rice;Lady Gaga.

Related questions

Hot questions

Language

Popular Tags