0

I am trying to open Motorola BLE API library for Android. I am not too familiar with Java so I am not sure if it is even possible.

When I try to open .class file from the library with notepad++ it contains something like: Êþº¾ and black squares.

Is there a way to open them properly?

SomeKittens
  • 38,868
  • 19
  • 114
  • 143
Arturs Vancans
  • 4,531
  • 14
  • 47
  • 76

6 Answers6

3

You can use the tool javap to disassemble .class files (= compiled Java code) but that won't tell you much.

Try to find the official documentation or the source (= .java files) by googling for the class name instead.

Aaron Digulla
  • 321,842
  • 108
  • 597
  • 820
1

You will need to de-compiler to read the .class files. There are various available in the market, which are open source and free. Here is one

Sameer Patil
  • 526
  • 4
  • 13
1

A .class file means that the library has already been compiled into Java's version of machine code, so you won't be able to view it in notepad. There are programs for decompiling class files back into source, but you need to make sure that a) you have the rights to do so, and b) that the particular decompiler supports the class file's particular version of Java.

For more information on decompilers, see this question: How do I decompile Java class files?

Community
  • 1
  • 1
Maythe
  • 576
  • 4
  • 13
1

If there source code (.java files) are provided , better use those. If not, then you have to use one of the de-compiler program. But even then if the code is obfuscated , even de-compiler would not be of any use. You have to use just the API documentation for any work.

sakthisundar
  • 3,278
  • 3
  • 16
  • 29
0

Java is a compiled language where the source is compiled into machine readable bytecode. You have to disassemble/decompile the bytecode to get it into an even semi-readable form.

Also note that the license of the library very probably forbids you from disassembling it.

Markus Mikkolainen
  • 3,397
  • 18
  • 21
0

If you are really using to use the api in your application then here is the way:

See the documentation of the api that is provided.

Also import the classes in with the import statement. For eg put the classes in a new folder as "api" in current folder and the import statement would be as follows: import api.*;

Then in the application logic make use of documentation on how to access the library.

Documentation here might help: https://developer.motorola.com/docs/bluetooth-low-energy-gatt-framework-api/

vivek_jonam
  • 3,237
  • 8
  • 32
  • 44